summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimm Bäder <[email protected]>2021-01-08 09:13:28 +0100
committerMark Wielaard <[email protected]>2021-01-29 21:57:17 +0100
commit0d8cbca2c0dbb43b9376b34676620e3027075852 (patch)
treec61717a9cfd5715bd1f06407427377045de80cfe /src
parent04e19e8a449beefad8a451bdd9a55afa8ab61456 (diff)
arlib-argp: Pull text_for_default() into file scope
Get rid of a nested function this way. Signed-off-by: Timm Bäder <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/arlib-argp.c21
2 files changed, 17 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 63bf7495..a7c9d2e8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,11 @@
2021-01-08 Timm Bäder <[email protected]>
+ * 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 <[email protected]>
+
* addr2line.c (handle_address): Move show_note and show_int up to
file scope.
(show_note: New static inline function.
diff --git a/src/arlib-argp.c b/src/arlib-argp.c
index c07d9299..a3c12e4d 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;
}