From d017d5af9cce1cba960ee8561ec08bf8f04a93b2 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 20 Dec 2021 20:03:35 -0500 Subject: 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. --- src/rc/_usage.h | 2 +- src/rc/checkpath.c | 2 +- src/rc/fstabinfo.c | 2 +- src/rc/kill_all.c | 2 +- src/rc/mountinfo.c | 2 +- src/rc/openrc-run.c | 2 +- src/rc/openrc-shutdown.c | 2 +- src/rc/rc-depend.c | 2 +- src/rc/rc-service.c | 2 +- src/rc/rc-status.c | 2 +- src/rc/rc-update.c | 2 +- src/rc/rc.c | 2 +- src/rc/start-stop-daemon.c | 2 +- src/rc/supervise-daemon.c | 2 +- src/rc/swclock.c | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/rc/_usage.h b/src/rc/_usage.h index fd20971b..a66e18b9 100644 --- a/src/rc/_usage.h +++ b/src/rc/_usage.h @@ -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; diff --git a/src/rc/checkpath.c b/src/rc/checkpath.c index c4dd7d9d..328f6f3f 100644 --- a/src/rc/checkpath.c +++ b/src/rc/checkpath.c @@ -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'}, diff --git a/src/rc/fstabinfo.c b/src/rc/fstabinfo.c index a35a52f6..57b41205 100644 --- a/src/rc/fstabinfo.c +++ b/src/rc/fstabinfo.c @@ -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' }, diff --git a/src/rc/kill_all.c b/src/rc/kill_all.c index bc079dea..762cc95c 100644 --- a/src/rc/kill_all.c +++ b/src/rc/kill_all.c @@ -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' }, diff --git a/src/rc/mountinfo.c b/src/rc/mountinfo.c index 5bf97386..87b41d1c 100644 --- a/src/rc/mountinfo.c +++ b/src/rc/mountinfo.c @@ -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'}, diff --git a/src/rc/openrc-run.c b/src/rc/openrc-run.c index 1958dbc8..7ef194c8 100644 --- a/src/rc/openrc-run.c +++ b/src/rc/openrc-run.c @@ -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'}, diff --git a/src/rc/openrc-shutdown.c b/src/rc/openrc-shutdown.c index c8c8d863..b10bcc59 100644 --- a/src/rc/openrc-shutdown.c +++ b/src/rc/openrc-shutdown.c @@ -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'}, diff --git a/src/rc/rc-depend.c b/src/rc/rc-depend.c index 51c6a5e1..cfc65e7d 100644 --- a/src/rc/rc-depend.c +++ b/src/rc/rc-depend.c @@ -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'}, diff --git a/src/rc/rc-service.c b/src/rc/rc-service.c index e9795650..715aff0e 100644 --- a/src/rc/rc-service.c +++ b/src/rc/rc-service.c @@ -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' }, diff --git a/src/rc/rc-status.c b/src/rc/rc-status.c index f086887e..4e47a230 100644 --- a/src/rc/rc-status.c +++ b/src/rc/rc-status.c @@ -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'}, diff --git a/src/rc/rc-update.c b/src/rc/rc-update.c index b0a73609..0363c669 100644 --- a/src/rc/rc-update.c +++ b/src/rc/rc-update.c @@ -36,7 +36,7 @@ const char *usagestring = "" \ "Usage: rc-update [options] add [...]\n" \ " or: rc-update [options] del [...]\n" \ " or: rc-update [options] [show [...]]"; -const char *getoptstring = "asu" getoptstring_COMMON; +const char getoptstring[] = "asu" getoptstring_COMMON; const struct option longopts[] = { { "all", 0, NULL, 'a' }, { "stack", 0, NULL, 's' }, diff --git a/src/rc/rc.c b/src/rc/rc.c index fd2081ca..056b58f1 100644 --- a/src/rc/rc.c +++ b/src/rc/rc.c @@ -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' }, diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c index 6bc70685..b643979c 100644 --- a/src/rc/start-stop-daemon.c +++ b/src/rc/start-stop-daemon.c @@ -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'}, diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c index 6e2b4331..17e8b68c 100644 --- a/src/rc/supervise-daemon.c +++ b/src/rc/supervise-daemon.c @@ -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'}, diff --git a/src/rc/swclock.c b/src/rc/swclock.c index 8245f116..97e5d42a 100644 --- a/src/rc/swclock.c +++ b/src/rc/swclock.c @@ -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' }, -- cgit v1.2.3