Eliminate popt wtf'ery in rpmcliInit()
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 4 Mar 2011 09:33:24 +0000 (11:33 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 4 Mar 2011 09:36:27 +0000 (11:36 +0200)
- In order to get inside the loop, rc has to be non-zero so the
  switch-case is just very very pointless (the whole check seems
  dubious but .. shrug)
- Remove unused optArg - if we don't look at it then no point
  retrieving it either

lib/poptALL.c

index f240909..30c29d6 100644 (file)
@@ -237,7 +237,6 @@ rpmcliFini(poptContext optCon)
 poptContext
 rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable)
 {
-    const char * optArg;
     poptContext optCon;
     int rc;
     const char *ctx, *execPath;
@@ -285,15 +284,9 @@ rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable)
 
     /* Process all options, whine if unknown. */
     while ((rc = poptGetNextOpt(optCon)) > 0) {
-       optArg = poptGetOptArg(optCon);
-       switch (rc) {
-       default:
-           fprintf(stderr, _("%s: option table misconfigured (%d)\n"),
+       fprintf(stderr, _("%s: option table misconfigured (%d)\n"),
                __progname, rc);
-           exit(EXIT_FAILURE);
-
-           break;
-        }
+       exit(EXIT_FAILURE);
     }
 
     if (rc < -1) {