diff options
author | Andreas Schwab <schwab@suse.de> | 2024-10-14 14:54:34 +0200 |
---|---|---|
committer | Andreas Schwab <schwab@suse.de> | 2024-10-16 15:34:07 +0200 |
commit | 620d68c984036917db8049560fd22291d63fda8a (patch) | |
tree | 6d8d7d7f0aa083c63d1a7ae5acb0a576b54e621e /gprofng/src/Module.cc | |
parent | 02d1e73bf63bb6d4e7c8b1eb35964cd2e00228d5 (diff) | |
download | gdb-620d68c984036917db8049560fd22291d63fda8a.zip gdb-620d68c984036917db8049560fd22291d63fda8a.tar.gz gdb-620d68c984036917db8049560fd22291d63fda8a.tar.bz2 |
gprofng: use xmalloc/xrealloc/xcalloc/xstrdup/xstrndup from libiberty
PR gprofng/32241
* src/Makefile.am (CSOURCES): Remove dbe_memmgr.c
* src/Makefile.in: Regenerate.
* src/dbe_memmgr.c: Remove.
* src/gprofng.cc (main): Call xmalloc_set_program_name.
* src/gp-archive.cc (main): Likewise.
* src/gp-collect-app.cc (main): Likewise.
* src/gp-display-src.cc (main): Likewise.
* src/gp-display-text.cc (main): Likewise.
* src/Application.cc: Use xmalloc, xrealloc, xcalloc, xstrdup,
xstrndup instead of malloc, realloc, calloc, strdup, strndup.
* src/BaseMetric.cc: Likewise.
* src/CallStack.cc: Likewise.
* src/ClassFile.cc: Likewise.
* src/Data_window.cc: Likewise.
* src/Dbe.cc: Likewise.
* src/DbeJarFile.cc: Likewise.
* src/DbeSession.cc: Likewise.
* src/DbeView.cc: Likewise.
* src/DerivedMetrics.cc: Likewise.
* src/DwarfLib.cc: Likewise.
* src/Elf.cc: Likewise.
* src/Emsg.cc: Likewise.
* src/Experiment.cc: Likewise.
* src/Function.cc: Likewise.
* src/Module.cc: Likewise.
* src/Print.cc: Likewise.
* src/QLParser.yy: Likewise.
* src/SAXParserFactory.cc: Likewise.
* src/Settings.cc: Likewise.
* src/SourceFile.cc: Likewise.
* src/StringBuilder.cc: Likewise.
* src/StringMap.h: Likewise.
* src/Table.cc: Likewise.
* src/checks.cc: Likewise.
* src/collctrl.cc: Likewise.
* src/comp_com.c: Likewise.
* src/count.cc: Likewise.
* src/envsets.cc: Likewise.
* src/gp-archive.cc: Likewise.
* src/gp-display-src.cc: Likewise.
* src/gp-display-text.cc: Likewise.
* src/gprofng.cc: Likewise.
* src/ipc.cc: Likewise.
* src/ipcio.cc: Likewise.
* src/vec.h: Likewise.
* src/util.cc: Likewise.
(get_prog_name): Remove.
* src/util.h: Likewise.
* src/dbe_hwc.h (malloc, realloc, calloc, strdup): Define.
Diffstat (limited to 'gprofng/src/Module.cc')
-rw-r--r-- | gprofng/src/Module.cc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/gprofng/src/Module.cc b/gprofng/src/Module.cc index d5255dc..064581c 100644 --- a/gprofng/src/Module.cc +++ b/gprofng/src/Module.cc @@ -368,7 +368,7 @@ Module::read_ar (int ar, int obj, char *obj_base) if (!strncmp (hdr.ar_name, NTXT ("//"), 2)) { longnames_size = get_ar_size (hdr.ar_size, sizeof (hdr.ar_size)); - longnames = (char *) malloc (longnames_size + 1); + longnames = (char *) xmalloc (longnames_size + 1); int64_t cnt = read_from_file (ar, longnames, longnames_size); if (cnt != (int64_t) longnames_size) { @@ -519,8 +519,8 @@ Module::setFile () char *path = loadobject->dbeFile->get_location (); if (path) { - disPath = strdup (path); - disName = strdup (path); + disPath = xstrdup (path); + disName = xstrdup (path); disMTime = loadobject->dbeFile->sbuf.st_mtime; } @@ -535,7 +535,7 @@ Module::setFile () size_t last = strlen (base) - 1; base[last] = '\0'; stabsTmp = dbeSession->get_tmp_file_name (base, false); - dbeSession->tmp_files->append (strdup (stabsTmp)); + dbeSession->tmp_files->append (xstrdup (stabsTmp)); DbeFile *dbf = dbeSession->getDbeFile (namebuf, DbeFile::F_DOT_A_LIB | DbeFile::F_FILE); @@ -553,8 +553,8 @@ Module::setFile () dbeFile->check_access (stabsTmp); // init 'sbuf' dbeFile->sbuf.st_mtime = 0; // Don't check timestamps dbeFile->container = dbf; - stabsPath = strdup (stabsTmp); - stabsName = strdup (path); + stabsPath = xstrdup (stabsTmp); + stabsName = xstrdup (path); stabsMTime = dbeFile->sbuf.st_mtime; } else @@ -573,8 +573,8 @@ Module::setFile () path = dbeFile->get_location (); if (path != NULL) { - stabsPath = strdup (path); - stabsName = strdup (path); + stabsPath = xstrdup (path); + stabsName = xstrdup (path); stabsMTime = hasDwarf ? 0 : dbeFile->sbuf.st_mtime; } } @@ -585,14 +585,14 @@ Module::setFile () { if (disPath == NULL) return false; - stabsPath = strdup (disPath); - stabsName = strdup (disName); + stabsPath = xstrdup (disPath); + stabsName = xstrdup (disName); stabsMTime = disMTime; } else if (disPath == NULL) { - disPath = strdup (stabsPath); - disName = strdup (stabsName); + disPath = xstrdup (stabsPath); + disName = xstrdup (stabsName); disMTime = stabsMTime; } } @@ -1278,7 +1278,7 @@ Module::set_src_data (Function *func, int vis_bits, int cmpline_visible, { Hist_data::HistItem *item = src_items->new_hist_item (NULL, AT_EMPTY, empty); - item->value[name_idx].l = strdup (NTXT ("")); + item->value[name_idx].l = xstrdup (NTXT ("")); data_items->append_hist_item (item); item = src_items->new_hist_item (NULL, AT_COM, empty); item->value[name_idx].l = dbe_sprintf (GTXT ("Compile flags: %s"), |