diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-03-26 20:04:27 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-03-26 20:04:27 +0000 |
commit | 8ee649a02e97e9d4e770a8138ba94c0f3ddd8055 (patch) | |
tree | cf13ce448542a36595264ad53397a0633ffedcc8 /libbb | |
parent | ce7eb4443cc90038aabc19a8b7b8f25e4b88892e (diff) | |
download | busybox-w32-8ee649a02e97e9d4e770a8138ba94c0f3ddd8055.tar.gz busybox-w32-8ee649a02e97e9d4e770a8138ba94c0f3ddd8055.tar.bz2 busybox-w32-8ee649a02e97e9d4e770a8138ba94c0f3ddd8055.zip |
*: more uniform naming: s/xmalloc_getline/xmalloc_fgetline/
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/get_line_from_file.c | 2 | ||||
-rw-r--r-- | libbb/lineedit.c | 2 | ||||
-rw-r--r-- | libbb/read.c | 11 |
3 files changed, 8 insertions, 7 deletions
diff --git a/libbb/get_line_from_file.c b/libbb/get_line_from_file.c index ac4d14b1f..b88872d53 100644 --- a/libbb/get_line_from_file.c +++ b/libbb/get_line_from_file.c | |||
@@ -57,7 +57,7 @@ char *xmalloc_fgets(FILE *file) | |||
57 | } | 57 | } |
58 | 58 | ||
59 | /* Get line. Remove trailing \n */ | 59 | /* Get line. Remove trailing \n */ |
60 | char *xmalloc_getline(FILE *file) | 60 | char *xmalloc_fgetline(FILE *file) |
61 | { | 61 | { |
62 | int i; | 62 | int i; |
63 | char *c = bb_get_chunk_from_file(file, &i); | 63 | char *c = bb_get_chunk_from_file(file, &i); |
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 5d65665d3..4ba61c143 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -969,7 +969,7 @@ static void load_history(const char *fromfile) | |||
969 | } | 969 | } |
970 | 970 | ||
971 | for (hi = 0; hi < MAX_HISTORY;) { | 971 | for (hi = 0; hi < MAX_HISTORY;) { |
972 | char *hl = xmalloc_getline(fp); | 972 | char *hl = xmalloc_fgetline(fp); |
973 | int l; | 973 | int l; |
974 | 974 | ||
975 | if (!hl) | 975 | if (!hl) |
diff --git a/libbb/read.c b/libbb/read.c index 9c025e3a3..1d31fb076 100644 --- a/libbb/read.c +++ b/libbb/read.c | |||
@@ -141,7 +141,7 @@ char *reads(int fd, char *buffer, size_t size) | |||
141 | off_t offset; | 141 | off_t offset; |
142 | *p++ = '\0'; | 142 | *p++ = '\0'; |
143 | // avoid incorrect (unsigned) widening | 143 | // avoid incorrect (unsigned) widening |
144 | offset = (off_t)(p-buffer) - (off_t)size; | 144 | offset = (off_t)(p - buffer) - (off_t)size; |
145 | // set fd position right after '\n' | 145 | // set fd position right after '\n' |
146 | if (offset && lseek(fd, offset, SEEK_CUR) == (off_t)-1) | 146 | if (offset && lseek(fd, offset, SEEK_CUR) == (off_t)-1) |
147 | return NULL; | 147 | return NULL; |
@@ -149,8 +149,8 @@ char *reads(int fd, char *buffer, size_t size) | |||
149 | return buffer; | 149 | return buffer; |
150 | } | 150 | } |
151 | 151 | ||
152 | // Read one line a-la fgets. Reads byte-by-byte. | 152 | // Reads one line a-la fgets (but doesn't save terminating '\n'). |
153 | // Useful when it is important to not read ahead. | 153 | // Reads byte-by-byte. Useful when it is important to not read ahead. |
154 | // Bytes are appended to pfx (which must be malloced, or NULL). | 154 | // Bytes are appended to pfx (which must be malloced, or NULL). |
155 | char *xmalloc_reads(int fd, char *buf, size_t *maxsz_p) | 155 | char *xmalloc_reads(int fd, char *buf, size_t *maxsz_p) |
156 | { | 156 | { |
@@ -178,9 +178,10 @@ char *xmalloc_reads(int fd, char *buf, size_t *maxsz_p) | |||
178 | break; | 178 | break; |
179 | p++; | 179 | p++; |
180 | } | 180 | } |
181 | *p++ = '\0'; | 181 | *p = '\0'; |
182 | if (maxsz_p) | 182 | if (maxsz_p) |
183 | *maxsz_p = p - buf - 1; | 183 | *maxsz_p = p - buf; |
184 | p++; | ||
184 | return xrealloc(buf, p - buf); | 185 | return xrealloc(buf, p - buf); |
185 | } | 186 | } |
186 | 187 | ||