Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1391237

[PATCH perf/core v2 8/8] perf tools: Remove xrealloc and ALLOC_GROW

From Masami Hiramatsu <mhiramat@kernel.org>
Newsgroups linux.kernel
Subject [PATCH perf/core v2 8/8] perf tools: Remove xrealloc and ALLOC_GROW
Date 2016-04-29 17:20 +0200
Message-ID <rtimZ-8fU-11@gated-at.bofh.it> (permalink)
References <rtidl-8c3-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Remove unused xrealloc() and ALLOC_GROW() from libperf.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 tools/perf/util/Build     |    1 -
 tools/perf/util/cache.h   |   19 -------------------
 tools/perf/util/util.h    |    6 ------
 tools/perf/util/wrapper.c |   29 -----------------------------
 4 files changed, 55 deletions(-)
 delete mode 100644 tools/perf/util/wrapper.c

diff --git a/tools/perf/util/Build b/tools/perf/util/Build
index 90229a8..b7768ea 100644
--- a/tools/perf/util/Build
+++ b/tools/perf/util/Build
@@ -27,7 +27,6 @@ libperf-y += strlist.o
 libperf-y += strfilter.o
 libperf-y += top.o
 libperf-y += usage.o
-libperf-y += wrapper.o
 libperf-y += dso.o
 libperf-y += symbol.o
 libperf-y += symbol_fprintf.o
diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
index 1f5a93c..0d814bb 100644
--- a/tools/perf/util/cache.h
+++ b/tools/perf/util/cache.h
@@ -40,25 +40,6 @@ int split_cmdline(char *cmdline, const char ***argv);
 
 #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)
 {
 	return path[0] == '/';
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 88f607a..7651633 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -160,12 +160,6 @@ static inline char *gitstrchrnul(const char *s, int c)
 }
 #endif
 
-/*
- * Wrappers:
- */
-void *xrealloc(void *ptr, size_t size) __attribute__((weak));
-
-
 static inline void *zalloc(size_t size)
 {
 	return calloc(1, size);
diff --git a/tools/perf/util/wrapper.c b/tools/perf/util/wrapper.c
deleted file mode 100644
index 5f1a07c..0000000
--- a/tools/perf/util/wrapper.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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;
-}

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH perf/core v2 0/8] perf tools: Update strbuf to remove xrealloc Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-29 17:10 +0200
  [PATCH perf/core v2 2/8] perf probe: Check the return value of strbuf APIs Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-29 17:20 +0200
    Re: [PATCH perf/core v2 2/8] perf probe: Check the return value of  strbuf APIs Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 01:50 +0200
      Re: [PATCH perf/core v2 2/8] perf probe: Check the return value of  strbuf APIs Masami Hiramatsu <mhiramat@kernel.org> - 2016-05-10 04:40 +0200
  [PATCH perf/core v2 5/8] perf header: Make topology checkers to check return value of strbuf Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-29 17:20 +0200
    Re: [PATCH perf/core v2 5/8] perf header: Make topology checkers to  check return value of strbuf Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 02:00 +0200
      Re: [PATCH perf/core v2 5/8] perf header: Make topology checkers to  check return value of strbuf Masami Hiramatsu <mhiramat@kernel.org> - 2016-05-10 05:00 +0200
  [PATCH perf/core v2 8/8] perf tools: Remove xrealloc and ALLOC_GROW Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-29 17:20 +0200
    Re: [PATCH perf/core v2 8/8] perf tools: Remove xrealloc and  ALLOC_GROW Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 02:00 +0200
  [PATCH perf/core v2 3/8] perf help: Make check_emacsclient_version to check strbuf APIs Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-29 17:20 +0200
    Re: [PATCH perf/core v2 3/8] perf help: Make  check_emacsclient_version to check strbuf APIs Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 02:00 +0200
  [PATCH perf/core v2 4/8] perf: Make alias handler to check return value of strbuf Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-29 17:20 +0200
    Re: [PATCH perf/core v2 4/8] perf: Make alias handler to check  return value of strbuf Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 02:00 +0200
  [PATCH perf/core v2 6/8] perf pmu: Make pmu_formats_string to check return value of strbuf Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-29 17:20 +0200
    Re: [PATCH perf/core v2 6/8] perf pmu: Make pmu_formats_string to  check return value of strbuf Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 02:00 +0200
  [PATCH perf/core v2 7/8] perf help: Do not use ALLOC_GROW in add_cmd_list Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-29 17:20 +0200
    Re: [PATCH perf/core v2 7/8] perf help: Do not use ALLOC_GROW in  add_cmd_list Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 02:00 +0200
  Re: [PATCH perf/core v2 0/8] perf tools: Update strbuf to remove  xrealloc Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-04-29 17:20 +0200
  [PATCH perf/core v2 1/8] perf: Rewrite strbuf not to die Masami Hiramatsu <mhiramat@kernel.org> - 2016-04-29 17:20 +0200
    Re: [PATCH perf/core v2 1/8] perf: Rewrite strbuf not to die Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 01:30 +0200
      Re: [PATCH perf/core v2 1/8] perf: Rewrite strbuf not to die Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-05-06 01:50 +0200
      Re: [PATCH perf/core v2 1/8] perf: Rewrite strbuf not to die Masami Hiramatsu <mhiramat@kernel.org> - 2016-05-10 03:10 +0200

csiph-web