change getopt definition to elide pointer storage

Make this a const pointer to the storage directly instead of a pointer
variable that points to the storage.  Makes the code slightly smaller.
This commit is contained in:
Mike Frysinger 2021-12-20 20:03:35 -05:00
parent 32aeb7407b
commit d017d5af9c
15 changed files with 15 additions and 15 deletions

View File

@ -46,7 +46,7 @@
extern const char *applet;
extern const char *extraopts;
extern const char *getoptstring;
extern const char getoptstring[];
extern const struct option longopts[];
extern const char * const longopts_help[];
extern const char *usagestring;

View File

@ -46,7 +46,7 @@ typedef enum {
const char *applet = NULL;
const char *extraopts ="path1 [path2] [...]";
const char *getoptstring = "dDfFpm:o:sW" getoptstring_COMMON;
const char getoptstring[] = "dDfFpm:o:sW" getoptstring_COMMON;
const struct option longopts[] = {
{ "directory", 0, NULL, 'd'},
{ "directory-truncate", 0, NULL, 'D'},

View File

@ -63,7 +63,7 @@
const char *applet = NULL;
const char *extraopts = NULL;
const char *getoptstring = "MRbmop:t:" getoptstring_COMMON;
const char getoptstring[] = "MRbmop:t:" getoptstring_COMMON;
const struct option longopts[] = {
{ "mount", 0, NULL, 'M' },
{ "remount", 0, NULL, 'R' },

View File

@ -36,7 +36,7 @@
const char *applet = NULL;
const char *extraopts = "[signal number]";
const char *getoptstring = "do:" getoptstring_COMMON;
const char getoptstring[] = "do:" getoptstring_COMMON;
const struct option longopts[] = {
{ "dry-run", 0, NULL, 'd' },
{ "omit", 1, NULL, 'o' },

View File

@ -48,7 +48,7 @@
const char *applet = NULL;
const char *procmounts = "/proc/mounts";
const char *extraopts = "[mount1] [mount2] ...";
const char *getoptstring = "f:F:n:N:o:O:p:P:iste:E:" getoptstring_COMMON;
const char getoptstring[] = "f:F:n:N:o:O:p:P:iste:E:" getoptstring_COMMON;
const struct option longopts[] = {
{ "fstype-regex", 1, NULL, 'f'},
{ "skip-fstype-regex", 1, NULL, 'F'},

View File

@ -63,7 +63,7 @@
const char *applet = NULL;
const char *extraopts = "stop | start | restart | describe | zap";
const char *getoptstring = "dDsSvl:Z" getoptstring_COMMON;
const char getoptstring[] = "dDsSvl:Z" getoptstring_COMMON;
const struct option longopts[] = {
{ "debug", 0, NULL, 'd'},
{ "dry-run", 0, NULL, 'Z'},

View File

@ -41,7 +41,7 @@
const char *applet = NULL;
const char *extraopts = NULL;
const char *getoptstring = "cdDfFHKpRrsw" getoptstring_COMMON;
const char getoptstring[] = "cdDfFHKpRrsw" getoptstring_COMMON;
const struct option longopts[] = {
{ "cancel", no_argument, NULL, 'c'},
{ "no-write", no_argument, NULL, 'd'},

View File

@ -39,7 +39,7 @@
const char *applet = NULL;
const char *extraopts = NULL;
const char *getoptstring = "aot:suTF:" getoptstring_COMMON;
const char getoptstring[] = "aot:suTF:" getoptstring_COMMON;
const struct option longopts[] = {
{ "starting", 0, NULL, 'a'},
{ "stopping", 0, NULL, 'o'},

View File

@ -29,7 +29,7 @@
const char *applet = NULL;
const char *extraopts = NULL;
const char *getoptstring = "cdDe:ilr:INsSZ" getoptstring_COMMON;
const char getoptstring[] = "cdDe:ilr:INsSZ" getoptstring_COMMON;
const struct option longopts[] = {
{ "debug", 0, NULL, 'd' },
{ "nodeps", 0, NULL, 'D' },

View File

@ -35,7 +35,7 @@ enum format_t {
const char *applet = NULL;
const char *extraopts = NULL;
const char *getoptstring = "acf:lmrsSu" getoptstring_COMMON;
const char getoptstring[] = "acf:lmrsSu" getoptstring_COMMON;
const struct option longopts[] = {
{"all", 0, NULL, 'a'},
{"crashed", 0, NULL, 'c'},

View File

@ -36,7 +36,7 @@ const char *usagestring = "" \
"Usage: rc-update [options] add <service> [<runlevel>...]\n" \
" or: rc-update [options] del <service> [<runlevel>...]\n" \
" or: rc-update [options] [show [<runlevel>...]]";
const char *getoptstring = "asu" getoptstring_COMMON;
const char getoptstring[] = "asu" getoptstring_COMMON;
const struct option longopts[] = {
{ "all", 0, NULL, 'a' },
{ "stack", 0, NULL, 's' },

View File

@ -56,7 +56,7 @@ static const char rc_copyright[] = "Copyright (c) 2007-2008 Roy Marples";
#include "_usage.h"
const char *extraopts = NULL;
const char *getoptstring = "a:no:s:S" getoptstring_COMMON;
const char getoptstring[] = "a:no:s:S" getoptstring_COMMON;
const struct option longopts[] = {
{ "no-stop", 0, NULL, 'n' },
{ "override", 1, NULL, 'o' },

View File

@ -66,7 +66,7 @@ static struct pam_conv conv = { NULL, NULL};
const char *applet = NULL;
const char *extraopts = NULL;
const char *getoptstring = "I:KN:PR:Sa:bc:d:e:g:ik:mn:op:s:tu:r:w:x:1:2:3:4:" \
const char getoptstring[] = "I:KN:PR:Sa:bc:d:e:g:ik:mn:op:s:tu:r:w:x:1:2:3:4:" \
getoptstring_COMMON;
const struct option longopts[] = {
{ "ionice", 1, NULL, 'I'},

View File

@ -68,7 +68,7 @@ static struct pam_conv conv = { NULL, NULL};
const char *applet = NULL;
const char *extraopts = NULL;
const char *getoptstring = "A:a:D:d:e:g:H:I:Kk:m:N:p:R:r:s:Su:1:2:3" \
const char getoptstring[] = "A:a:D:d:e:g:H:I:Kk:m:N:p:R:r:s:Su:1:2:3" \
getoptstring_COMMON;
const struct option longopts[] = {
{ "healthcheck-timer", 1, NULL, 'a'},

View File

@ -38,7 +38,7 @@
const char *applet = NULL;
const char *extraopts = "file";
const char *getoptstring = "sw" getoptstring_COMMON;
const char getoptstring[] = "sw" getoptstring_COMMON;
const struct option longopts[] = {
{ "save", 0, NULL, 's' },
{ "warn", 0, NULL, 'w' },