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/vec.h | |
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/vec.h')
-rw-r--r-- | gprofng/src/vec.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gprofng/src/vec.h b/gprofng/src/vec.h index 7d5be1f..4ee4642 100644 --- a/gprofng/src/vec.h +++ b/gprofng/src/vec.h @@ -25,6 +25,7 @@ #include <inttypes.h> #include <string.h> #include <stdlib.h> +#include "libiberty.h" // This package implements a vector of items. @@ -222,7 +223,7 @@ Vector<ITEM>::Vector (long sz) { count = 0; limit = sz > 0 ? sz : KILOCHUNK; // was 0; - data = limit ? (ITEM *) malloc (sizeof (ITEM) * limit) : NULL; + data = limit ? (ITEM *) xmalloc (sizeof (ITEM) * limit) : NULL; sorted = false; } @@ -241,7 +242,7 @@ Vector<ITEM> else limit = limit * 2; } - data = (ITEM *) realloc (data, limit * sizeof (ITEM)); + data = (ITEM *) xrealloc (data, limit * sizeof (ITEM)); } template <typename ITEM> void @@ -269,7 +270,7 @@ Vector<ITEM>::copy () vector = new Vector<ITEM>; vector->count = count; vector->limit = limit; - vector->data = (ITEM *) malloc (sizeof (ITEM) * limit); + vector->data = (ITEM *) xmalloc (sizeof (ITEM) * limit); (void) memcpy ((char *) vector->data, (char *) data, sizeof (ITEM) * count); return vector; } |