perf tools: Remove some unused functions
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 <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user