#include <assert.h>
#include <time.h>
#include <zlib.h>
-#ifdef HAVE_WCHAR_H
#include <wchar.h>
-#endif
#if __GNUC__ >= 2
/* Define BFD64 here, even if our default architecture is 32 bit ELF
static bool do_demangle = false; /* Pretty print C++ symbol names. */
static bool process_links = false;
static int demangle_flags = DMGL_ANSI | DMGL_PARAMS;
+static int sym_base = 0;
static char *dump_ctf_parent_name;
static char *dump_ctf_symtab_name;
bfd_vma * gnuchains;
bfd_vma * mipsxlat;
bfd_vma gnusymidx;
- char program_interpreter[PATH_MAX];
+ char * program_interpreter;
bfd_vma dynamic_info[DT_ENCODING];
bfd_vma dynamic_info_DT_GNU_HASH;
bfd_vma dynamic_info_DT_MIPS_XHASH;
typedef enum print_mode
{
HEX,
+ HEX_5,
DEC,
DEC_5,
UNSIGNED,
+ UNSIGNED_5,
PREFIX_HEX,
+ PREFIX_HEX_5,
FULL_HEX,
- LONG_HEX
+ LONG_HEX,
+ OCTAL,
+ OCTAL_5
}
print_mode;
case HEX:
return nc + printf ("%" BFD_VMA_FMT "x", vma);
+ case PREFIX_HEX_5:
+ nc = printf ("0x");
+ /* Fall through. */
+ case HEX_5:
+ return nc + printf ("%05" BFD_VMA_FMT "x", vma);
+
case DEC:
return printf ("%" BFD_VMA_FMT "d", vma);
case UNSIGNED:
return printf ("%" BFD_VMA_FMT "u", vma);
+ case UNSIGNED_5:
+ return printf ("%5" BFD_VMA_FMT "u", vma);
+
+ case OCTAL:
+ return printf ("%" BFD_VMA_FMT "o", vma);
+
+ case OCTAL_5:
+ return printf ("%5" BFD_VMA_FMT "o", vma);
+
default:
/* FIXME: Report unrecognised mode ? */
return 0;
}
}
+
/* Display a symbol on stdout. Handles the display of control characters and
multibye characters (assuming the host environment supports them).
OPTION_WITH_SYMBOL_VERSIONS,
OPTION_RECURSE_LIMIT,
OPTION_NO_RECURSE_LIMIT,
- OPTION_NO_DEMANGLING
+ OPTION_NO_DEMANGLING,
+ OPTION_SYM_BASE
};
static struct option options[] =
{"ctf-strings", required_argument, 0, OPTION_CTF_STRINGS},
{"ctf-parent", required_argument, 0, OPTION_CTF_PARENT},
#endif
+ {"sym-base", optional_argument, 0, OPTION_SYM_BASE},
{0, no_argument, 0, 0}
};
--symbols An alias for --syms\n\
--dyn-syms Display the dynamic symbol table\n\
--lto-syms Display LTO symbol tables\n\
+ --sym-base=[0|8|10|16] \n\
+ Force base for symbol sizes. The options are \n\
+ mixed (the default), octal, decimal, hexadecimal.\n\
-C --demangle[=STYLE] Decode low-level symbol names into user-level names\n\
The STYLE, if specified, can be `auto' (the default),\n\
`gnu', `lucid', `arm', `hp', `edg', `gnu-v3', `java'\n\
/* Ignored for backward compatibility. */
break;
+ case OPTION_SYM_BASE:
+ sym_base = 0;
+ if (optarg != NULL)
+ {
+ sym_base = strtoul (optarg, NULL, 0);
+ switch (sym_base)
+ {
+ case 0:
+ case 8:
+ case 10:
+ case 16:
+ break;
+
+ default:
+ sym_base = 0;
+ break;
+ }
+ }
+ break;
+
default:
/* xgettext:c-format */
error (_("Invalid option '-%c'\n"), c);
break;
case PT_INTERP:
- if (fseek (filedata->handle,
- filedata->archive_file_offset + (long) segment->p_offset,
- SEEK_SET))
+ if (segment->p_offset >= filedata->file_size
+ || segment->p_filesz > filedata->file_size - segment->p_offset
+ || segment->p_filesz - 1 >= (size_t) -2
+ || fseek (filedata->handle,
+ filedata->archive_file_offset + (long) segment->p_offset,
+ SEEK_SET))
error (_("Unable to find program interpreter name\n"));
else
{
- char fmt [32];
- int ret = snprintf (fmt, sizeof (fmt), "%%%ds", PATH_MAX - 1);
-
- if (ret >= (int) sizeof (fmt) || ret < 0)
- error (_("Internal error: failed to create format string to display program interpreter\n"));
-
- filedata->program_interpreter[0] = 0;
- if (fscanf (filedata->handle, fmt,
- filedata->program_interpreter) <= 0)
- error (_("Unable to read program interpreter name\n"));
+ size_t len = segment->p_filesz;
+ free (filedata->program_interpreter);
+ filedata->program_interpreter = xmalloc (len + 1);
+ len = fread (filedata->program_interpreter, 1, len,
+ filedata->handle);
+ filedata->program_interpreter[len] = 0;
if (do_segments)
printf (_(" [Requesting program interpreter: %s]\n"),
|| do_debug_str || do_debug_str_offsets || do_debug_loc
|| do_debug_ranges
|| do_debug_addr || do_debug_cu_index || do_debug_links)
- && (const_strneq (name, ".debug_")
- || const_strneq (name, ".zdebug_")))
+ && (startswith (name, ".debug_")
+ || startswith (name, ".zdebug_")))
{
if (name[1] == 'z')
name += sizeof (".zdebug_") - 1;
name += sizeof (".debug_") - 1;
if (do_debugging
- || (do_debug_info && const_strneq (name, "info"))
- || (do_debug_info && const_strneq (name, "types"))
- || (do_debug_abbrevs && const_strneq (name, "abbrev"))
+ || (do_debug_info && startswith (name, "info"))
+ || (do_debug_info && startswith (name, "types"))
+ || (do_debug_abbrevs && startswith (name, "abbrev"))
|| (do_debug_lines && strcmp (name, "line") == 0)
- || (do_debug_lines && const_strneq (name, "line."))
- || (do_debug_pubnames && const_strneq (name, "pubnames"))
- || (do_debug_pubtypes && const_strneq (name, "pubtypes"))
- || (do_debug_pubnames && const_strneq (name, "gnu_pubnames"))
- || (do_debug_pubtypes && const_strneq (name, "gnu_pubtypes"))
- || (do_debug_aranges && const_strneq (name, "aranges"))
- || (do_debug_ranges && const_strneq (name, "ranges"))
- || (do_debug_ranges && const_strneq (name, "rnglists"))
- || (do_debug_frames && const_strneq (name, "frame"))
- || (do_debug_macinfo && const_strneq (name, "macinfo"))
- || (do_debug_macinfo && const_strneq (name, "macro"))
- || (do_debug_str && const_strneq (name, "str"))
- || (do_debug_links && const_strneq (name, "sup"))
- || (do_debug_str_offsets && const_strneq (name, "str_offsets"))
- || (do_debug_loc && const_strneq (name, "loc"))
- || (do_debug_loc && const_strneq (name, "loclists"))
- || (do_debug_addr && const_strneq (name, "addr"))
- || (do_debug_cu_index && const_strneq (name, "cu_index"))
- || (do_debug_cu_index && const_strneq (name, "tu_index"))
+ || (do_debug_lines && startswith (name, "line."))
+ || (do_debug_pubnames && startswith (name, "pubnames"))
+ || (do_debug_pubtypes && startswith (name, "pubtypes"))
+ || (do_debug_pubnames && startswith (name, "gnu_pubnames"))
+ || (do_debug_pubtypes && startswith (name, "gnu_pubtypes"))
+ || (do_debug_aranges && startswith (name, "aranges"))
+ || (do_debug_ranges && startswith (name, "ranges"))
+ || (do_debug_ranges && startswith (name, "rnglists"))
+ || (do_debug_frames && startswith (name, "frame"))
+ || (do_debug_macinfo && startswith (name, "macinfo"))
+ || (do_debug_macinfo && startswith (name, "macro"))
+ || (do_debug_str && startswith (name, "str"))
+ || (do_debug_links && startswith (name, "sup"))
+ || (do_debug_str_offsets && startswith (name, "str_offsets"))
+ || (do_debug_loc && startswith (name, "loc"))
+ || (do_debug_loc && startswith (name, "loclists"))
+ || (do_debug_addr && startswith (name, "addr"))
+ || (do_debug_cu_index && startswith (name, "cu_index"))
+ || (do_debug_cu_index && startswith (name, "tu_index"))
)
request_dump_bynumber (&filedata->dump, i, DEBUG_DUMP);
}
/* Linkonce section to be combined with .debug_info at link time. */
else if ((do_debugging || do_debug_info)
- && const_strneq (name, ".gnu.linkonce.wi."))
+ && startswith (name, ".gnu.linkonce.wi."))
request_dump_bynumber (&filedata->dump, i, DEBUG_DUMP);
else if (do_debug_frames && streq (name, ".eh_frame"))
request_dump_bynumber (&filedata->dump, i, DEBUG_DUMP);
/* Trace sections for Itanium VMS. */
else if ((do_debugging || do_trace_info || do_trace_abbrevs
|| do_trace_aranges)
- && const_strneq (name, ".trace_"))
+ && startswith (name, ".trace_"))
{
name += sizeof (".trace_") - 1;
request_dump_bynumber (&filedata->dump, i, DEBUG_DUMP);
}
else if ((do_debugging || do_debug_links)
- && (const_strneq (name, ".gnu_debuglink")
- || const_strneq (name, ".gnu_debugaltlink")))
+ && (startswith (name, ".gnu_debuglink")
+ || startswith (name, ".gnu_debugaltlink")))
request_dump_bynumber (&filedata->dump, i, DEBUG_DUMP);
}
if (filedata->is_separate)
printf (_("Section groups in linked file '%s'\n"), filedata->file_name);
-
+
for (i = 0, section = filedata->section_headers, group = filedata->section_groups;
i < filedata->file_header.e_shnum;
i++, section++)
printf
(_("\n'%s' relocation section at offset 0x%lx contains %ld bytes:\n"),
name, rel_offset, rel_size);
-
dump_relocations (filedata,
offset_from_vma (filedata, rel_offset, rel_size),
continue;
}
- if (! const_strneq (relname, "R_IA64_SEGREL"))
+ if (! startswith (relname, "R_IA64_SEGREL"))
{
warn (_("Skipping unexpected relocation type: %s\n"), relname);
continue;
}
}
else if (SECTION_NAME_VALID (unwsec)
- && strneq (SECTION_NAME (unwsec),
- ELF_STRING_ia64_unwind_once, len))
+ && startswith (SECTION_NAME (unwsec),
+ ELF_STRING_ia64_unwind_once))
{
/* .gnu.linkonce.ia64unw.FOO -> .gnu.linkonce.ia64unwi.FOO. */
len2 = sizeof (ELF_STRING_ia64_unwind_info_once) - 1;
i < filedata->file_header.e_shnum;
++i, ++sec)
if (SECTION_NAME_VALID (sec)
- && strneq (SECTION_NAME (sec),
- ELF_STRING_ia64_unwind_info_once, len2)
+ && startswith (SECTION_NAME (sec),
+ ELF_STRING_ia64_unwind_info_once)
&& streq (SECTION_NAME (sec) + len2, suffix))
break;
}
len2 = sizeof (ELF_STRING_ia64_unwind_info) - 1;
suffix = "";
if (SECTION_NAME_VALID (unwsec)
- && strneq (SECTION_NAME (unwsec), ELF_STRING_ia64_unwind, len))
+ && startswith (SECTION_NAME (unwsec), ELF_STRING_ia64_unwind))
suffix = SECTION_NAME (unwsec) + len;
for (i = 0, sec = filedata->section_headers;
i < filedata->file_header.e_shnum;
++i, ++sec)
if (SECTION_NAME_VALID (sec)
- && strneq (SECTION_NAME (sec), ELF_STRING_ia64_unwind_info, len2)
+ && startswith (SECTION_NAME (sec), ELF_STRING_ia64_unwind_info)
&& streq (SECTION_NAME (sec) + len2, suffix))
break;
}
}
/* R_PARISC_SEGREL32 or R_PARISC_SEGREL64. */
- if (! const_strneq (relname, "R_PARISC_SEGREL"))
+ if (! startswith (relname, "R_PARISC_SEGREL"))
{
warn (_("Skipping unexpected relocation type: %s\n"), relname);
continue;
encoding, starting with one byte giving the number of
words. */
if (procname != NULL
- && (const_strneq (procname, "__gcc_personality_v0")
- || const_strneq (procname, "__gxx_personality_v0")
- || const_strneq (procname, "__gcj_personality_v0")
- || const_strneq (procname, "__gnu_objc_personality_v0")))
+ && (startswith (procname, "__gcc_personality_v0")
+ || startswith (procname, "__gxx_personality_v0")
+ || startswith (procname, "__gcj_personality_v0")
+ || startswith (procname, "__gnu_objc_personality_v0")))
{
remaining = 0;
more_words = 1;
case DT_NEEDED:
printf (_("Shared library: [%s]"), name);
- if (streq (name, filedata->program_interpreter))
+ if (filedata->program_interpreter
+ && streq (name, filedata->program_interpreter))
printf (_(" program interpreter"));
break;
section->sh_info),
printable_section_name (filedata, section),
section->sh_info);
-
+
printf (_(" Addr: 0x"));
printf_vma (section->sh_addr);
printf (_(" Offset: %#08lx Link: %u (%s)\n"),
section->sh_info),
printable_section_name (filedata, section),
section->sh_info);
-
+
printf (_(" Addr: 0x"));
printf_vma (section->sh_addr);
printf (_(" Offset: %#08lx Link: %u (%s)\n"),
return NULL;
}
+/* Display a symbol size on stdout. Format is based on --sym-base setting. */
+
+static unsigned int
+print_dynamic_symbol_size (bfd_vma vma, int base)
+{
+ switch (base)
+ {
+ case 8:
+ return print_vma (vma, OCTAL_5);
+
+ case 10:
+ return print_vma (vma, UNSIGNED_5);
+
+ case 16:
+ return print_vma (vma, PREFIX_HEX_5);
+
+ case 0:
+ default:
+ return print_vma (vma, DEC_5);
+ }
+}
+
static void
print_dynamic_symbol (Filedata *filedata, unsigned long si,
Elf_Internal_Sym *symtab,
const char *version_string;
enum versioned_symbol_info sym_info;
unsigned short vna_other;
+ bool is_valid;
+ const char * sstr;
Elf_Internal_Sym *psym = symtab + si;
printf ("%6ld: ", si);
print_vma (psym->st_value, LONG_HEX);
putchar (' ');
- print_vma (psym->st_size, DEC_5);
+ print_dynamic_symbol_size (psym->st_size, sym_base);
printf (" %-7s", get_symbol_type (filedata, ELF_ST_TYPE (psym->st_info)));
printf (" %-6s", get_symbol_binding (filedata, ELF_ST_BIND (psym->st_info)));
if (filedata->file_header.e_ident[EI_OSABI] == ELFOSABI_SOLARIS)
}
printf (" %4s ", get_symbol_index_type (filedata, psym->st_shndx));
- bool is_valid = VALID_SYMBOL_NAME (strtab, strtab_size, psym->st_name);
- const char * sstr = is_valid ? strtab + psym->st_name : _("<corrupt>");
+ if (ELF_ST_TYPE (psym->st_info) == STT_SECTION
+ && psym->st_shndx < filedata->file_header.e_shnum
+ && psym->st_name == 0)
+ {
+ is_valid = SECTION_NAME_VALID (filedata->section_headers + psym->st_shndx);
+ sstr = is_valid ?
+ SECTION_NAME_PRINT (filedata->section_headers + psym->st_shndx)
+ : _("<corrupt>");
+ }
+ else
+ {
+ is_valid = VALID_SYMBOL_NAME (strtab, strtab_size, psym->st_name);
+ sstr = is_valid ? strtab + psym->st_name : _("<corrupt>");
+ }
version_string
= get_symbol_version_string (filedata,
else
printf (_("\nLTO Symbol table '%s' is empty!\n"),
printable_section_name (filedata, section));
-
+
return true;
}
/* Check if this is the build-id note. If so then convert the build-id
bytes to a hex string. */
if (inote.namesz > 0
- && const_strneq (inote.namedata, "GNU")
+ && startswith (inote.namedata, "GNU")
&& inote.type == NT_GNU_BUILD_ID)
{
unsigned long j;
return false;
}
- if (const_strneq (name, ".gnu.linkonce.wi."))
+ if (startswith (name, ".gnu.linkonce.wi."))
name = ".debug_info";
/* See if we know how to display the contents of this section. */
struct dwarf_section * sec = & display->section;
if (streq (sec->uncompressed_name, name)
- || (id == line && const_strneq (name, ".debug_line."))
+ || (id == line && startswith (name, ".debug_line."))
|| streq (sec->compressed_name, name))
{
bool secondary = (section != find_section (filedata, name));
if (secondary)
free_debug_section (id);
- if (i == line && const_strneq (name, ".debug_line."))
+ if (i == line && startswith (name, ".debug_line."))
sec->name = name;
else if (streq (sec->uncompressed_name, name))
sec->name = sec->uncompressed_name;
if (filedata->is_separate && ! process_links)
dump &= DEBUG_DUMP;
-
+
#ifdef SUPPORT_DISASSEMBLY
if (dump & DISASS_DUMP)
{
pnote->descdata);
return true;
-#ifdef NT_NETBSD_PAX
case NT_NETBSD_PAX:
if (pnote->descsz < 1)
break;
((version & NT_NETBSD_PAX_ASLR) ? "+ASLR" : ""),
((version & NT_NETBSD_PAX_NOASLR) ? "-ASLR" : ""));
return true;
-#endif
}
printf (" NetBSD\t0x%08lx\tUnknown note type: (0x%08lx)\n",
/* NetBSD core "procinfo" structure. */
return _("NetBSD procinfo structure");
-#ifdef NT_NETBSDCORE_AUXV
case NT_NETBSDCORE_AUXV:
return _("NetBSD ELF auxiliary vector data");
-#endif
-#ifdef NT_NETBSDCORE_LWPSTATUS
case NT_NETBSDCORE_LWPSTATUS:
return _("PT_LWPSTATUS (ptrace_lwpstatus structure)");
-#endif
default:
/* As of Jan 2020 there are no other machine-independent notes
note type strings. */
nt = get_note_type (filedata, pnote->type);
- else if (const_strneq (pnote->namedata, "GNU"))
+ else if (startswith (pnote->namedata, "GNU"))
/* GNU-specific object file notes. */
nt = get_gnu_elf_note_type (pnote->type);
- else if (const_strneq (pnote->namedata, "FreeBSD"))
+ else if (startswith (pnote->namedata, "FreeBSD"))
/* FreeBSD-specific core file notes. */
nt = get_freebsd_elfcore_note_type (filedata, pnote->type);
- else if (const_strneq (pnote->namedata, "NetBSD-CORE"))
+ else if (startswith (pnote->namedata, "NetBSD-CORE"))
/* NetBSD-specific core file notes. */
nt = get_netbsd_elfcore_note_type (filedata, pnote->type);
- else if (const_strneq (pnote->namedata, "NetBSD"))
+ else if (startswith (pnote->namedata, "NetBSD"))
/* NetBSD-specific core file notes. */
return process_netbsd_elf_note (pnote);
- else if (const_strneq (pnote->namedata, "PaX"))
+ else if (startswith (pnote->namedata, "PaX"))
/* NetBSD-specific core file notes. */
return process_netbsd_elf_note (pnote);
- else if (strneq (pnote->namedata, "SPU/", 4))
+ else if (startswith (pnote->namedata, "SPU/"))
{
/* SPU-specific core file notes. */
nt = pnote->namedata + 4;
name = "SPU";
}
- else if (const_strneq (pnote->namedata, "IPF/VMS"))
+ else if (startswith (pnote->namedata, "IPF/VMS"))
/* VMS/ia64-specific file notes. */
nt = get_ia64_vms_note_type (pnote->type);
- else if (const_strneq (pnote->namedata, "stapsdt"))
+ else if (startswith (pnote->namedata, "stapsdt"))
nt = get_stapsdt_note_type (pnote->type);
else
printf (" ");
- if (((const_strneq (pnote->namedata, "GA")
+ if (((startswith (pnote->namedata, "GA")
&& strchr ("*$!+", pnote->namedata[2]) != NULL)
|| strchr ("*$!+", pnote->namedata[0]) != NULL)
&& (pnote->type == NT_GNU_BUILD_ATTRIBUTE_OPEN
else
printf (" 0x%08lx\t%s\n", pnote->descsz, nt);
- if (const_strneq (pnote->namedata, "IPF/VMS"))
+ if (startswith (pnote->namedata, "IPF/VMS"))
return print_ia64_vms_note (pnote);
- else if (const_strneq (pnote->namedata, "GNU"))
+ else if (startswith (pnote->namedata, "GNU"))
return print_gnu_note (filedata, pnote);
- else if (const_strneq (pnote->namedata, "stapsdt"))
+ else if (startswith (pnote->namedata, "stapsdt"))
return print_stapsdt_note (pnote);
- else if (const_strneq (pnote->namedata, "CORE"))
+ else if (startswith (pnote->namedata, "CORE"))
return print_core_note (pnote);
- else if (((const_strneq (pnote->namedata, "GA")
+ else if (((startswith (pnote->namedata, "GA")
&& strchr ("*$!+", pnote->namedata[2]) != NULL)
|| strchr ("*$!+", pnote->namedata[0]) != NULL)
&& (pnote->type == NT_GNU_BUILD_ATTRIBUTE_OPEN
return true;
}
+static void
+free_filedata (Filedata *filedata)
+{
+ free (filedata->program_interpreter);
+ filedata->program_interpreter = NULL;
+
+ free (filedata->program_headers);
+ filedata->program_headers = NULL;
+
+ free (filedata->section_headers);
+ filedata->section_headers = NULL;
+
+ free (filedata->string_table);
+ filedata->string_table = NULL;
+ filedata->string_table_length = 0;
+
+ free (filedata->dump.dump_sects);
+ filedata->dump.dump_sects = NULL;
+ filedata->dump.num_dump_sects = 0;
+
+ free (filedata->dynamic_strings);
+ filedata->dynamic_strings = NULL;
+ filedata->dynamic_strings_length = 0;
+
+ free (filedata->dynamic_symbols);
+ filedata->dynamic_symbols = NULL;
+ filedata->num_dynamic_syms = 0;
+
+ free (filedata->dynamic_syminfo);
+ filedata->dynamic_syminfo = NULL;
+
+ free (filedata->dynamic_section);
+ filedata->dynamic_section = NULL;
+
+ while (filedata->symtab_shndx_list != NULL)
+ {
+ elf_section_list *next = filedata->symtab_shndx_list->next;
+ free (filedata->symtab_shndx_list);
+ filedata->symtab_shndx_list = next;
+ }
+
+ free (filedata->section_headers_groups);
+ filedata->section_headers_groups = NULL;
+
+ if (filedata->section_groups)
+ {
+ size_t i;
+ struct group_list * g;
+ struct group_list * next;
+
+ for (i = 0; i < filedata->group_count; i++)
+ {
+ for (g = filedata->section_groups [i].root; g != NULL; g = next)
+ {
+ next = g->next;
+ free (g);
+ }
+ }
+
+ free (filedata->section_groups);
+ filedata->section_groups = NULL;
+ }
+}
+
static void
close_file (Filedata * filedata)
{
void
close_debug_file (void * data)
{
+ free_filedata ((Filedata *) data);
close_file ((Filedata *) data);
}
if (! process_arch_specific (filedata))
res = false;
- free (filedata->program_headers);
- filedata->program_headers = NULL;
-
- free (filedata->section_headers);
- filedata->section_headers = NULL;
-
- free (filedata->string_table);
- filedata->string_table = NULL;
- filedata->string_table_length = 0;
-
- free (filedata->dump.dump_sects);
- filedata->dump.dump_sects = NULL;
- filedata->dump.num_dump_sects = 0;
-
- free (filedata->dynamic_strings);
- filedata->dynamic_strings = NULL;
- filedata->dynamic_strings_length = 0;
-
- free (filedata->dynamic_symbols);
- filedata->dynamic_symbols = NULL;
- filedata->num_dynamic_syms = 0;
-
- free (filedata->dynamic_syminfo);
- filedata->dynamic_syminfo = NULL;
-
- free (filedata->dynamic_section);
- filedata->dynamic_section = NULL;
-
- while (filedata->symtab_shndx_list != NULL)
- {
- elf_section_list *next = filedata->symtab_shndx_list->next;
- free (filedata->symtab_shndx_list);
- filedata->symtab_shndx_list = next;
- }
-
- free (filedata->section_headers_groups);
- filedata->section_headers_groups = NULL;
-
- if (filedata->section_groups)
- {
- struct group_list * g;
- struct group_list * next;
-
- for (i = 0; i < filedata->group_count; i++)
- {
- for (g = filedata->section_groups [i].root; g != NULL; g = next)
- {
- next = g->next;
- free (g);
- }
- }
-
- free (filedata->section_groups);
- filedata->section_groups = NULL;
- }
+ free_filedata (filedata);
free_debug_memory ();
{
int err;
-#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
+#ifdef HAVE_LC_MESSAGES
setlocale (LC_MESSAGES, "");
#endif
-#if defined (HAVE_SETLOCALE)
setlocale (LC_CTYPE, "");
-#endif
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);