From a41794cdd7ee94a5199e14f642c26d649d383fa5 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Tue, 18 May 2010 18:29:23 -0300 Subject: perf tools: Remove some unused functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without the bloated cplus_demangle from binutils, i.e building with: $ make NO_DEMANGLE=1 O=~acme/git/build/perf -j3 -C tools/perf/ install Before: text data bss dec hex filename 471851 29280 4025056 4526187 45106b /home/acme/bin/perf After: [acme@doppio linux-2.6-tip]$ size ~/bin/perf text data bss dec hex filename 446886 29232 4008576 4484694 446e56 /home/acme/bin/perf So its a 5.3% size reduction in code, but the interesting part is in the git diff --stat output: 19 files changed, 20 insertions(+), 1909 deletions(-) If we ever need some of the things we got from git but weren't using, we just have to go to the git repo and get fresh, uptodate source code bits. Cc: Frédéric Weisbecker Cc: Mike Galbraith Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Tom Zanussi LKML-Reference: Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/wrapper.c | 72 +---------------------------------------------- 1 file changed, 1 insertion(+), 71 deletions(-) (limited to 'tools/perf/util/wrapper.c') diff --git a/tools/perf/util/wrapper.c b/tools/perf/util/wrapper.c index bf44ca8..c4ced7c 100644 --- a/tools/perf/util/wrapper.c +++ b/tools/perf/util/wrapper.c @@ -48,7 +48,7 @@ void *xmalloc(size_t size) * and returns a pointer to the allocated memory. If the allocation fails, * the program dies. */ -void *xmemdupz(const void *data, size_t len) +static void *xmemdupz(const void *data, size_t len) { char *p = xmalloc(len + 1); memcpy(p, data, len); @@ -78,73 +78,3 @@ void *xrealloc(void *ptr, size_t size) } return ret; } - -/* - * xread() is the same a read(), but it automatically restarts read() - * operations with a recoverable error (EAGAIN and EINTR). xread() - * DOES NOT GUARANTEE that "len" bytes is read even if the data is available. - */ -static ssize_t xread(int fd, void *buf, size_t len) -{ - ssize_t nr; - while (1) { - nr = read(fd, buf, len); - if ((nr < 0) && (errno == EAGAIN || errno == EINTR)) - continue; - return nr; - } -} - -/* - * xwrite() is the same a write(), but it automatically restarts write() - * operations with a recoverable error (EAGAIN and EINTR). xwrite() DOES NOT - * GUARANTEE that "len" bytes is written even if the operation is successful. - */ -static ssize_t xwrite(int fd, const void *buf, size_t len) -{ - ssize_t nr; - while (1) { - nr = write(fd, buf, len); - if ((nr < 0) && (errno == EAGAIN || errno == EINTR)) - continue; - return nr; - } -} - -ssize_t read_in_full(int fd, void *buf, size_t count) -{ - char *p = buf; - ssize_t total = 0; - - while (count > 0) { - ssize_t loaded = xread(fd, p, count); - if (loaded <= 0) - return total ? total : loaded; - count -= loaded; - p += loaded; - total += loaded; - } - - return total; -} - -ssize_t write_in_full(int fd, const void *buf, size_t count) -{ - const char *p = buf; - ssize_t total = 0; - - while (count > 0) { - ssize_t written = xwrite(fd, p, count); - if (written < 0) - return -1; - if (!written) { - errno = ENOSPC; - return -1; - } - count -= written; - p += written; - total += written; - } - - return total; -} -- cgit v1.1