From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752914AbcEJUhH (ORCPT ); Tue, 10 May 2016 16:37:07 -0400 Received: from terminus.zytor.com ([198.137.202.10]:58462 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751466AbcEJUhF (ORCPT ); Tue, 10 May 2016 16:37:05 -0400 Date: Tue, 10 May 2016 13:36:30 -0700 From: tip-bot for Masami Hiramatsu Message-ID: Cc: acme@redhat.com, mhiramat@kernel.org, namhyung@kernel.org, hpa@zytor.com, tglx@linutronix.de, peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org Reply-To: mingo@kernel.org, linux-kernel@vger.kernel.org, acme@redhat.com, mhiramat@kernel.org, namhyung@kernel.org, hpa@zytor.com, tglx@linutronix.de, peterz@infradead.org In-Reply-To: <20160510054801.6158.6204.stgit@devbox> References: <20160510054801.6158.6204.stgit@devbox> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf tools: Remove xrealloc and ALLOC_GROW Git-Commit-ID: 452e84012595d681f254a3a0d733fb0b18ffaf42 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 452e84012595d681f254a3a0d733fb0b18ffaf42 Gitweb: http://git.kernel.org/tip/452e84012595d681f254a3a0d733fb0b18ffaf42 Author: Masami Hiramatsu AuthorDate: Tue, 10 May 2016 14:48:01 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 10 May 2016 11:58:27 -0300 perf tools: Remove xrealloc and ALLOC_GROW Remove unused xrealloc() and ALLOC_GROW() from libperf. Signed-off-by: Masami Hiramatsu Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20160510054801.6158.6204.stgit@devbox Signed-off-by: Arnaldo Carvalho de Melo --- 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(-) diff --git a/tools/perf/util/Build b/tools/perf/util/Build index 027bb2b..8c6c8a0 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; -}