diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2014-01-14 05:01:41 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2014-01-28 11:10:48 +0100 |
commit | ffe7f6d16187e3a4b0bd273c212d92aac73d70f0 (patch) | |
tree | 69e55553a63106abdd56619beedd99347c8c47d3 /src | |
parent | 8a434aeb4616cec416419a216a620038d98024d3 (diff) | |
download | pacman-ffe7f6d16187e3a4b0bd273c212d92aac73d70f0.tar.gz pacman-ffe7f6d16187e3a4b0bd273c212d92aac73d70f0.tar.xz |
pacman.c: remove unnecessary optarg checks
getopt takes care of making sure that options that require a value have
one. These checks were only added to silence clang, which no longer
complains about optarg being unchecked, and newer options already use
optarg unchecked.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman/pacman.c | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 6bf94e98..1fb447c6 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -321,8 +321,6 @@ static void handler(int signum) cleanup(128 + signum); } -#define check_optarg() if(!optarg) { return 1; } - static void invalid_opt(int used, const char *opt1, const char *opt2) { if(used) { @@ -337,7 +335,6 @@ static int parsearg_util_addlist(alpm_list_t **list) { char *i, *save; - check_optarg(); for(i = strtok_r(optarg, ",", &save); i; i = strtok_r(NULL, ",", &save)) { *list = alpm_list_add(*list, strdup(i)); @@ -393,16 +390,13 @@ static int parsearg_global(int opt) { switch(opt) { case OP_ARCH: - check_optarg(); config_set_arch(optarg); break; case OP_ASK: - check_optarg(); config->noask = 1; config->ask = (unsigned int)atoi(optarg); break; case OP_CACHEDIR: - check_optarg(); config->cachedirs = alpm_list_add(config->cachedirs, strdup(optarg)); break; case OP_COLOR: @@ -420,7 +414,6 @@ static int parsearg_global(int opt) enable_colors(config->color); break; case OP_CONFIG: - check_optarg(); if(config->configfile) { free(config->configfile); } @@ -453,7 +446,6 @@ static int parsearg_global(int opt) config->gpgdir = strdup(optarg); break; case OP_LOGFILE: - check_optarg(); config->logfile = strndup(optarg, PATH_MAX); break; case OP_NOCONFIRM: @@ -461,12 +453,10 @@ static int parsearg_global(int opt) break; case OP_DBPATH: case 'b': - check_optarg(); config->dbpath = strdup(optarg); break; case OP_ROOT: case 'r': - check_optarg(); config->rootdir = strdup(optarg); break; case OP_VERBOSE: @@ -632,7 +622,6 @@ static int parsearg_trans(int opt) config->print = 1; break; case OP_PRINTFORMAT: - check_optarg(); config->print = 1; config->print_format = strdup(optarg); break; |