From 924862c864da0b62cf93ba7abf2dc78a7e6ac48f Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Fri, 8 Apr 2011 17:58:55 +0300 Subject: mtd-utils: switch ubi and ubifs tools to use common strtoX funcs Instead of using strtol and Co directly, use our share simple_strtoX() helpers. This is just a cleanup. Signed-off-by: Artem Bityutskiy --- ubi-utils/src/ubimkvol.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'ubi-utils/src/ubimkvol.c') diff --git a/ubi-utils/src/ubimkvol.c b/ubi-utils/src/ubimkvol.c index f6e498f..db71e2f 100644 --- a/ubi-utils/src/ubimkvol.c +++ b/ubi-utils/src/ubimkvol.c @@ -121,8 +121,7 @@ static int param_sanity_check(void) static int parse_opt(int argc, char * const argv[]) { while (1) { - int key; - char *endp; + int key, error = 1; key = getopt_long(argc, argv, "a:n:N:s:S:t:h?Vm", long_options, NULL); if (key == -1) @@ -145,20 +144,20 @@ static int parse_opt(int argc, char * const argv[]) break; case 'S': - args.lebs = strtoull(optarg, &endp, 0); - if (endp == optarg || args.lebs <= 0 || *endp != '\0') + args.lebs = simple_strtoull(optarg, &error); + if (error || args.lebs <= 0) return errmsg("bad LEB count: \"%s\"", optarg); break; case 'a': - args.alignment = strtoul(optarg, &endp, 0); - if (*endp != '\0' || endp == optarg || args.alignment <= 0) + args.alignment = simple_strtoul(optarg, &error); + if (error || args.alignment <= 0) return errmsg("bad volume alignment: \"%s\"", optarg); break; case 'n': - args.vol_id = strtoul(optarg, &endp, 0); - if (*endp != '\0' || endp == optarg || args.vol_id < 0) + args.vol_id = simple_strtoul(optarg, &error); + if (error || args.vol_id < 0) return errmsg("bad volume ID: " "\"%s\"", optarg); break; -- cgit v1.2.3