aboutsummaryrefslogtreecommitdiff
path: root/libbb/get_line_from_file.c
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-04-12 00:32:05 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2007-04-12 00:32:05 +0000
commite91ac05530803390f7aa5ca646d90ae26c48aa52 (patch)
tree7a912fc65ff43bdb09078d75bfc02ad8f5380b47 /libbb/get_line_from_file.c
parent13adb67bb086c45d7191966ca5fa3bff1de2dd74 (diff)
downloadbusybox-w32-e91ac05530803390f7aa5ca646d90ae26c48aa52.tar.gz
busybox-w32-e91ac05530803390f7aa5ca646d90ae26c48aa52.tar.bz2
busybox-w32-e91ac05530803390f7aa5ca646d90ae26c48aa52.zip
style fixes. No code changes
git-svn-id: svn://busybox.net/trunk/busybox@18409 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'libbb/get_line_from_file.c')
-rw-r--r--libbb/get_line_from_file.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libbb/get_line_from_file.c b/libbb/get_line_from_file.c
index 2c9608e9e..1eb4af13c 100644
--- a/libbb/get_line_from_file.c
+++ b/libbb/get_line_from_file.c
@@ -17,7 +17,7 @@
17 * end of line. If end isn't NULL, length of the chunk read is stored in it. 17 * end of line. If end isn't NULL, length of the chunk read is stored in it.
18 * Return NULL if EOF/error */ 18 * Return NULL if EOF/error */
19 19
20char *bb_get_chunk_from_file(FILE * file, int *end) 20char *bb_get_chunk_from_file(FILE *file, int *end)
21{ 21{
22 int ch; 22 int ch;
23 int idx = 0; 23 int idx = 0;
@@ -27,7 +27,8 @@ char *bb_get_chunk_from_file(FILE * file, int *end)
27 while ((ch = getc(file)) != EOF) { 27 while ((ch = getc(file)) != EOF) {
28 /* grow the line buffer as necessary */ 28 /* grow the line buffer as necessary */
29 if (idx >= linebufsz) { 29 if (idx >= linebufsz) {
30 linebuf = xrealloc(linebuf, linebufsz += 80); 30 linebufsz += 80;
31 linebuf = xrealloc(linebuf, linebufsz);
31 } 32 }
32 linebuf[idx++] = (char) ch; 33 linebuf[idx++] = (char) ch;
33 if (!ch || (end && ch == '\n')) 34 if (!ch || (end && ch == '\n'))
@@ -49,7 +50,7 @@ char *bb_get_chunk_from_file(FILE * file, int *end)
49} 50}
50 51
51/* Get line, including trailing \n if any */ 52/* Get line, including trailing \n if any */
52char *xmalloc_fgets(FILE * file) 53char *xmalloc_fgets(FILE *file)
53{ 54{
54 int i; 55 int i;
55 56
@@ -57,7 +58,7 @@ char *xmalloc_fgets(FILE * file)
57} 58}
58 59
59/* Get line. Remove trailing \n */ 60/* Get line. Remove trailing \n */
60char *xmalloc_getline(FILE * file) 61char *xmalloc_getline(FILE *file)
61{ 62{
62 int i; 63 int i;
63 char *c = bb_get_chunk_from_file(file, &i); 64 char *c = bb_get_chunk_from_file(file, &i);