summaryrefslogtreecommitdiff
path: root/src/nm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nm.c')
-rw-r--r--src/nm.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/nm.c b/src/nm.c
index b99805e8..16647589 100644
--- a/src/nm.c
+++ b/src/nm.c
@@ -137,8 +137,8 @@ static int handle_elf (int fd, Elf *elf, const char *prefix, const char *fname,
#define INTERNAL_ERROR(fname) \
- error (EXIT_FAILURE, 0, _("%s: INTERNAL ERROR %d (%s): %s"), \
- fname, __LINE__, PACKAGE_VERSION, elf_errmsg (-1))
+ error_exit (0, _("%s: INTERNAL ERROR %d (%s): %s"), \
+ fname, __LINE__, PACKAGE_VERSION, elf_errmsg (-1))
/* Internal representation of symbols. */
@@ -378,7 +378,7 @@ process_file (const char *fname, bool more_than_one)
INTERNAL_ERROR (fname);
if (close (fd) != 0)
- error (EXIT_FAILURE, errno, _("while closing '%s'"), fname);
+ error_exit (errno, _("while closing '%s'"), fname);
return result;
}
@@ -390,7 +390,7 @@ process_file (const char *fname, bool more_than_one)
INTERNAL_ERROR (fname);
if (close (fd) != 0)
- error (EXIT_FAILURE, errno, _("while closing '%s'"), fname);
+ error_exit (errno, _("while closing '%s'"), fname);
return result;
}
@@ -687,8 +687,7 @@ get_local_names (Dwarf *dbg)
}
/* We have all the information. Create a record. */
- struct local_name *newp
- = (struct local_name *) xmalloc (sizeof (*newp));
+ struct local_name *newp = xmalloc (sizeof (*newp));
newp->name = name;
newp->file = dwarf_filesrc (files, fileidx, NULL, NULL);
newp->lineno = lineno;
@@ -701,8 +700,7 @@ get_local_names (Dwarf *dbg)
struct local_name **tres = tsearch (newp, &local_root,
local_compare);
if (tres == NULL)
- error (EXIT_FAILURE, errno,
- _("cannot create search tree"));
+ error_exit (errno, _("cannot create search tree"));
else if (*tres != newp)
free (newp);
}
@@ -736,14 +734,13 @@ show_symbols_sysv (Ebl *ebl, GElf_Word strndx, const char *fullname,
bool scnnames_malloced = shnum * sizeof (const char *) > 128 * 1024;
const char **scnnames;
if (scnnames_malloced)
- scnnames = (const char **) xmalloc (sizeof (const char *) * shnum);
+ scnnames = xmalloc (sizeof (const char *) * shnum);
else
scnnames = (const char **) alloca (sizeof (const char *) * shnum);
/* Get the section header string table index. */
size_t shstrndx;
if (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0)
- error (EXIT_FAILURE, 0,
- _("cannot get section header string table index"));
+ error_exit (0, _("cannot get section header string table index"));
/* Cache the section names. */
Elf_Scn *scn = NULL;
@@ -1235,8 +1232,7 @@ show_symbols (int fd, Ebl *ebl, GElf_Ehdr *ehdr,
/* Get the section header string table index. */
size_t shstrndx;
if (elf_getshdrstrndx (ebl->elf, &shstrndx) < 0)
- error (EXIT_FAILURE, 0,
- _("cannot get section header string table index"));
+ error_exit (0, _("cannot get section header string table index"));
/* The section is that large. */
size_t size = shdr->sh_size;
@@ -1332,15 +1328,14 @@ show_symbols (int fd, Ebl *ebl, GElf_Ehdr *ehdr,
can use the data memory instead of copying again if what we read
is a 64 bit file. */
if (nentries > SIZE_MAX / sizeof (GElf_SymX))
- error (EXIT_FAILURE, 0,
- _("%s: entries (%zd) in section %zd `%s' is too large"),
- fullname, nentries, elf_ndxscn (scn),
- elf_strptr (ebl->elf, shstrndx, shdr->sh_name));
+ error_exit (0, _("%s: entries (%zd) in section %zd `%s' is too large"),
+ fullname, nentries, elf_ndxscn (scn),
+ elf_strptr (ebl->elf, shstrndx, shdr->sh_name));
GElf_SymX *sym_mem;
if (nentries * sizeof (GElf_SymX) < MAX_STACK_ALLOC)
sym_mem = (GElf_SymX *) alloca (nentries * sizeof (GElf_SymX));
else
- sym_mem = (GElf_SymX *) xmalloc (nentries * sizeof (GElf_SymX));
+ sym_mem = xmalloc (nentries * sizeof (GElf_SymX));
/* Iterate over all symbols. */
#ifdef USE_DEMANGLE