Commit 452e8401 authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Arnaldo Carvalho de Melo

perf tools: Remove xrealloc and ALLOC_GROW

Remove unused xrealloc() and ALLOC_GROW() from libperf.
Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20160510054801.6158.6204.stgit@devboxSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 682f4f03
...@@ -27,7 +27,6 @@ libperf-y += strlist.o ...@@ -27,7 +27,6 @@ libperf-y += strlist.o
libperf-y += strfilter.o libperf-y += strfilter.o
libperf-y += top.o libperf-y += top.o
libperf-y += usage.o libperf-y += usage.o
libperf-y += wrapper.o
libperf-y += dso.o libperf-y += dso.o
libperf-y += symbol.o libperf-y += symbol.o
libperf-y += symbol_fprintf.o libperf-y += symbol_fprintf.o
......
...@@ -40,25 +40,6 @@ int split_cmdline(char *cmdline, const char ***argv); ...@@ -40,25 +40,6 @@ int split_cmdline(char *cmdline, const char ***argv);
#define alloc_nr(x) (((x)+16)*3/2) #define alloc_nr(x) (((x)+16)*3/2)
/*
* Realloc the buffer pointed at by variable 'x' so that it can hold
* at least 'nr' entries; the number of entries currently allocated
* is 'alloc', using the standard growing factor alloc_nr() macro.
*
* DO NOT USE any expression with side-effect for 'x' or 'alloc'.
*/
#define ALLOC_GROW(x, nr, alloc) \
do { \
if ((nr) > alloc) { \
if (alloc_nr(alloc) < (nr)) \
alloc = (nr); \
else \
alloc = alloc_nr(alloc); \
x = xrealloc((x), alloc * sizeof(*(x))); \
} \
} while(0)
static inline int is_absolute_path(const char *path) static inline int is_absolute_path(const char *path)
{ {
return path[0] == '/'; return path[0] == '/';
......
...@@ -160,12 +160,6 @@ static inline char *gitstrchrnul(const char *s, int c) ...@@ -160,12 +160,6 @@ static inline char *gitstrchrnul(const char *s, int c)
} }
#endif #endif
/*
* Wrappers:
*/
void *xrealloc(void *ptr, size_t size) __attribute__((weak));
static inline void *zalloc(size_t size) static inline void *zalloc(size_t size)
{ {
return calloc(1, size); return calloc(1, size);
......
/*
* Various trivial helper wrappers around standard functions
*/
#include "cache.h"
/*
* There's no pack memory to release - but stay close to the Git
* version so wrap this away:
*/
static inline void release_pack_memory(size_t size __maybe_unused,
int flag __maybe_unused)
{
}
void *xrealloc(void *ptr, size_t size)
{
void *ret = realloc(ptr, size);
if (!ret && !size)
ret = realloc(ptr, 1);
if (!ret) {
release_pack_memory(size, -1);
ret = realloc(ptr, size);
if (!ret && !size)
ret = realloc(ptr, 1);
if (!ret)
die("Out of memory, realloc failed");
}
return ret;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment