prog_util: remove unused skip_bytes() function

This commit is contained in:
Eric Biggers 2016-10-16 18:16:38 -07:00
parent 31c4ac39a7
commit 1cc88c6f86
2 changed files with 0 additions and 34 deletions

View File

@ -361,39 +361,6 @@ xread(struct file_stream *strm, void *buf, size_t count)
return orig_count - 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 */ /* Write to a file, returning 0 if all bytes were written or -1 on error */
int int
full_write(struct file_stream *strm, const void *buf, size_t count) full_write(struct file_stream *strm, const void *buf, size_t count)

View File

@ -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 int map_file_contents(struct file_stream *strm, u64 size);
extern ssize_t xread(struct file_stream *strm, void *buf, size_t count); 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 full_write(struct file_stream *strm, const void *buf, size_t count);
extern int xclose(struct file_stream *strm); extern int xclose(struct file_stream *strm);