From: Jens Axboe Date: Wed, 28 Jun 2017 00:01:17 +0000 (-0600) Subject: mtd: add private rpmatch() X-Git-Tag: fio-2.99~20 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=2ad9c0bb913d75abe5e06d7ce40237b3772fec5b;p=fio.git mtd: add private rpmatch() No point in doing elaborate checks for uclibc versions, when we can just include this (very) small function ourselves. Apparently this is also problematic on Android. Fixes: https://github.com/axboe/fio/issues/390 Signed-off-by: Jens Axboe --- diff --git a/oslib/libmtd_common.h b/oslib/libmtd_common.h index 9768066b..3f9e1b8c 100644 --- a/oslib/libmtd_common.h +++ b/oslib/libmtd_common.h @@ -119,20 +119,11 @@ extern "C" { fprintf(stderr, "%s: warning!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \ } while(0) -#if defined(__UCLIBC__) -/* uClibc versions before 0.9.34 don't have rpmatch() */ -#if __UCLIBC_MAJOR__ == 0 && \ - (__UCLIBC_MINOR__ < 9 || \ - (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ < 34)) -#undef rpmatch -#define rpmatch __rpmatch -static inline int __rpmatch(const char *resp) +static inline int mtd_rpmatch(const char *resp) { return (resp[0] == 'y' || resp[0] == 'Y') ? 1 : (resp[0] == 'n' || resp[0] == 'N') ? 0 : -1; } -#endif -#endif /** * prompt the user for confirmation @@ -154,7 +145,7 @@ static inline bool prompt(const char *msg, bool def) } if (strcmp("\n", line) != 0) { - switch (rpmatch(line)) { + switch (mtd_rpmatch(line)) { case 0: ret = false; break; case 1: ret = true; break; case -1: