From 2ad9c0bb913d75abe5e06d7ce40237b3772fec5b Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 27 Jun 2017 18:01:17 -0600 Subject: [PATCH] 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 --- oslib/libmtd_common.h | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) 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: -- 2.25.1