From 1cc88c6f8682e85d302a5442c9e7ff2dbae7d696 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sun, 16 Oct 2016 18:16:38 -0700 Subject: [PATCH] prog_util: remove unused skip_bytes() function --- programs/prog_util.c | 33 --------------------------------- programs/prog_util.h | 1 - 2 files changed, 34 deletions(-) diff --git a/programs/prog_util.c b/programs/prog_util.c index 6a59abe..efb19f9 100644 --- a/programs/prog_util.c +++ b/programs/prog_util.c @@ -361,39 +361,6 @@ xread(struct file_stream *strm, void *buf, size_t count) return orig_count - count; } -/* Skip over 'count' bytes from a file, returning 0 on success or -1 on error */ -int -skip_bytes(struct file_stream *strm, size_t count) -{ - size_t bufsize; - char *buffer; - ssize_t ret; - - if (count == 0) - return 0; - - bufsize = MIN(count, 4096); - buffer = xmalloc(bufsize); - if (buffer == NULL) - return -1; - do { - size_t n = MIN(count, bufsize); - ret = xread(strm, buffer, n); - if (ret < 0) - goto out; - if (ret != n) { - msg("%"TS": unexpected end-of-file", strm->name); - ret = -1; - goto out; - } - count -= ret; - } while (count != 0); - ret = 0; -out: - free(buffer); - return ret; -} - /* Write to a file, returning 0 if all bytes were written or -1 on error */ int full_write(struct file_stream *strm, const void *buf, size_t count) diff --git a/programs/prog_util.h b/programs/prog_util.h index 2aa35a4..711d8bd 100644 --- a/programs/prog_util.h +++ b/programs/prog_util.h @@ -141,7 +141,6 @@ extern int xopen_for_write(const tchar *path, bool force, extern int map_file_contents(struct file_stream *strm, u64 size); extern ssize_t xread(struct file_stream *strm, void *buf, size_t count); -extern int skip_bytes(struct file_stream *strm, size_t count); extern int full_write(struct file_stream *strm, const void *buf, size_t count); extern int xclose(struct file_stream *strm);