+2021-01-08 Timm Bäder <tbaeder@redhat.com>
+
+ * readelf.c (parse_opt): Lift add_dump_section function to...
+ (add_dump_section): ...here. New top level function. Added key
+ argument.
+
2021-01-08 Timm Bäder <tbaeder@redhat.com>
* arlib-argp.c (help_filter): Lift text_for_default function to...
return error_message_count != 0;
}
+static void
+add_dump_section (const char *name,
+ int key,
+ bool implicit)
+{
+ struct section_argument *a = xmalloc (sizeof *a);
+ a->arg = name;
+ a->next = NULL;
+ a->implicit = implicit;
+ struct section_argument ***tailp
+ = key == 'x' ? &dump_data_sections_tail : &string_sections_tail;
+ **tailp = a;
+ *tailp = &a->next;
+}
/* Handle program arguments. */
static error_t
parse_opt (int key, char *arg,
struct argp_state *state __attribute__ ((unused)))
{
- void add_dump_section (const char *name, bool implicit)
- {
- struct section_argument *a = xmalloc (sizeof *a);
- a->arg = name;
- a->next = NULL;
- a->implicit = implicit;
- struct section_argument ***tailp
- = key == 'x' ? &dump_data_sections_tail : &string_sections_tail;
- **tailp = a;
- *tailp = &a->next;
- }
-
switch (key)
{
case 'a':
print_arch = true;
print_notes = true;
implicit_debug_sections |= section_exception;
- add_dump_section (".strtab", true);
- add_dump_section (".dynstr", true);
- add_dump_section (".comment", true);
+ add_dump_section (".strtab", key, true);
+ add_dump_section (".dynstr", key, true);
+ add_dump_section (".comment", key, true);
any_control_option = true;
break;
case 'A':
}
FALLTHROUGH;
case 'x':
- add_dump_section (arg, false);
+ add_dump_section (arg, key, false);
any_control_option = true;
break;
case 'N':