aboutsummaryrefslogtreecommitdiff
path: root/libbb/read.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-08-04 21:16:46 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-08-04 21:16:46 +0000
commit855ff6f503ee50fad3eb6fa30e2b02f53f32d63d (patch)
tree7cc63f646f0c9c5bcacefe2a8e453a3796902af0 /libbb/read.c
parent5db861a9eb93c4562798654f53022088784f35eb (diff)
downloadbusybox-855ff6f503ee50fad3eb6fa30e2b02f53f32d63d.tar.gz
modprobe: use buffering line reads (fgets) instead of reads().
libbb: remove reads() function old new delta include_conf_file_act 961 980 +19 localcmd 282 284 +2 already_loaded 155 151 -4 in_cksum 58 53 -5 modprobe_main 1630 1624 -6 reads 129 - -129 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 2/3 up/down: 21/-144) Total: -123 bytes
Diffstat (limited to 'libbb/read.c')
-rw-r--r--libbb/read.c25
1 files changed, 0 insertions, 25 deletions
diff --git a/libbb/read.c b/libbb/read.c
index 7af895207..18f62838e 100644
--- a/libbb/read.c
+++ b/libbb/read.c
@@ -127,31 +127,6 @@ unsigned char FAST_FUNC xread_char(int fd)
return tmp;
}
-/* Read one line a-la fgets. Works only on seekable streams */
-char* FAST_FUNC reads(int fd, char *buffer, size_t size)
-{
- char *p;
-
- if (size < 2)
- return NULL;
- size = full_read(fd, buffer, size-1);
- if ((ssize_t)size <= 0)
- return NULL;
-
- buffer[size] = '\0';
- p = strchr(buffer, '\n');
- if (p) {
- off_t offset;
- *p++ = '\0';
- /* avoid incorrect (unsigned) widening */
- offset = (off_t)(p - buffer) - (off_t)size;
- /* set fd position right after '\n' */
- if (offset && lseek(fd, offset, SEEK_CUR) == (off_t)-1)
- return NULL;
- }
- return buffer;
-}
-
// Reads one line a-la fgets (but doesn't save terminating '\n').
// Reads byte-by-byte. Useful when it is important to not read ahead.
// Bytes are appended to pfx (which must be malloced, or NULL).