From f25f4ef6d123173d7669553ec712419f95c1a3ea Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 6 Jul 2017 08:09:22 -0600 Subject: [PATCH] oslib/libmtd: kill dead code Signed-off-by: Jens Axboe --- oslib/libmtd_common.h | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/oslib/libmtd_common.h b/oslib/libmtd_common.h index 3f9e1b8c..35628fea 100644 --- a/oslib/libmtd_common.h +++ b/oslib/libmtd_common.h @@ -119,48 +119,6 @@ extern "C" { fprintf(stderr, "%s: warning!: " fmt "\n", PROGRAM_NAME, ##__VA_ARGS__); \ } while(0) -static inline int mtd_rpmatch(const char *resp) -{ - return (resp[0] == 'y' || resp[0] == 'Y') ? 1 : - (resp[0] == 'n' || resp[0] == 'N') ? 0 : -1; -} - -/** - * prompt the user for confirmation - */ -static inline bool prompt(const char *msg, bool def) -{ - char *line = NULL; - size_t len; - bool ret = def; - - do { - normsg_cont("%s (%c/%c) ", msg, def ? 'Y' : 'y', def ? 'n' : 'N'); - fflush(stdout); - - while (getline(&line, &len, stdin) == -1) { - printf("failed to read prompt; assuming '%s'\n", - def ? "yes" : "no"); - break; - } - - if (strcmp("\n", line) != 0) { - switch (mtd_rpmatch(line)) { - case 0: ret = false; break; - case 1: ret = true; break; - case -1: - puts("unknown response; please try again"); - continue; - } - } - break; - } while (1); - - free(line); - - return ret; -} - static inline int is_power_of_2(unsigned long long n) { return (n != 0 && ((n & (n - 1)) == 0)); -- 2.25.1