From: Timm Bäder Date: Fri, 8 Jan 2021 08:13:28 +0000 (+0100) Subject: arlib-argp: Pull text_for_default() into file scope X-Git-Tag: elfutils-0.183~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0d8cbca2c0dbb43b9376b34676620e3027075852;p=thirdparty%2Felfutils.git arlib-argp: Pull text_for_default() into file scope Get rid of a nested function this way. Signed-off-by: Timm Bäder --- diff --git a/src/ChangeLog b/src/ChangeLog index 63bf74953..a7c9d2e80 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2021-01-08 Timm Bäder + + * arlib-argp.c (help_filter): Lift text_for_default function to... + (text_for_default): ... here. New file scope function taking text + as argument. + 2021-01-08 Timm Bäder * addr2line.c (handle_address): Move show_note and show_int up to diff --git a/src/arlib-argp.c b/src/arlib-argp.c index c07d9299b..a3c12e4d9 100644 --- a/src/arlib-argp.c +++ b/src/arlib-argp.c @@ -57,25 +57,26 @@ parse_opt (int key, char *arg __attribute__ ((unused)), } static char * -help_filter (int key, const char *text, void *input __attribute__ ((unused))) +text_for_default (const char *text) { - inline char *text_for_default (void) - { - char *new_text; - if (unlikely (asprintf (&new_text, _("%s (default)"), text) < 0)) - return (char *) text; - return new_text; - } + char *new_text; + if (unlikely (asprintf (&new_text, _("%s (default)"), text) < 0)) + return (char *) text; + return new_text; +} +static char * +help_filter (int key, const char *text, void *input __attribute__ ((unused))) +{ switch (key) { case 'D': if (DEFAULT_AR_DETERMINISTIC) - return text_for_default (); + return text_for_default (text); break; case 'U': if (! DEFAULT_AR_DETERMINISTIC) - return text_for_default (); + return text_for_default (text); break; }