]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
arlib-argp: Pull text_for_default() into file scope
authorTimm Bäder <tbaeder@redhat.com>
Fri, 8 Jan 2021 08:13:28 +0000 (09:13 +0100)
committerMark Wielaard <mark@klomp.org>
Fri, 29 Jan 2021 20:57:17 +0000 (21:57 +0100)
Get rid of a nested function this way.

Signed-off-by: Timm Bäder <tbaeder@redhat.com>
src/ChangeLog
src/arlib-argp.c

index 63bf749533465eb58899d8fb753503f55cc1826a..a7c9d2e80ccab829564ba9c0e6809eeb6bf75963 100644 (file)
@@ -1,3 +1,9 @@
+2021-01-08  Timm Bäder  <tbaeder@redhat.com>
+
+       * 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  <tbaeder@redhat.com>
 
        * addr2line.c (handle_address): Move show_note and show_int up to
index c07d9299be19e022ade6d27e3f69f0d52c255789..a3c12e4d9e5d8f54841cc6d18255b29690a60d27 100644 (file)
@@ -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;
     }