diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-26 23:25:17 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-10-26 23:25:17 +0000 |
commit | ddec5af6b0803c7434a1cc2fdee5cb9873fe6bd0 (patch) | |
tree | f4f2aa58fa669aed6e2c50bb7aa648a79ec1873d /libbb/fgets_str.c | |
parent | f0ed376eda5d5c25d270e5100a881fb2d801bee6 (diff) | |
download | busybox-w32-ddec5af6b0803c7434a1cc2fdee5cb9873fe6bd0.tar.gz busybox-w32-ddec5af6b0803c7434a1cc2fdee5cb9873fe6bd0.tar.bz2 busybox-w32-ddec5af6b0803c7434a1cc2fdee5cb9873fe6bd0.zip |
rename functions to more understandable names
Diffstat (limited to 'libbb/fgets_str.c')
-rw-r--r-- | libbb/fgets_str.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/libbb/fgets_str.c b/libbb/fgets_str.c index 41370d176..1bc6c3b1c 100644 --- a/libbb/fgets_str.c +++ b/libbb/fgets_str.c | |||
@@ -8,17 +8,12 @@ | |||
8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | |||
12 | #include <stdio.h> | ||
13 | #include <stdlib.h> | ||
14 | #include <string.h> | ||
15 | |||
16 | #include "libbb.h" | 11 | #include "libbb.h" |
17 | 12 | ||
18 | /* Read up to (and including) TERMINATING_STRING from FILE and return it. | 13 | /* Read up to (and including) TERMINATING_STRING from FILE and return it. |
19 | * Return NULL on EOF. */ | 14 | * Return NULL on EOF. */ |
20 | 15 | ||
21 | char *fgets_str(FILE *file, const char *terminating_string) | 16 | char *xmalloc_fgets_str(FILE *file, const char *terminating_string) |
22 | { | 17 | { |
23 | char *linebuf = NULL; | 18 | char *linebuf = NULL; |
24 | const int term_length = strlen(terminating_string); | 19 | const int term_length = strlen(terminating_string); |
@@ -36,7 +31,8 @@ char *fgets_str(FILE *file, const char *terminating_string) | |||
36 | 31 | ||
37 | /* grow the line buffer as necessary */ | 32 | /* grow the line buffer as necessary */ |
38 | while (idx > linebufsz - 2) { | 33 | while (idx > linebufsz - 2) { |
39 | linebuf = xrealloc(linebuf, linebufsz += 1000); | 34 | linebufsz += 200; |
35 | linebuf = xrealloc(linebuf, linebufsz); | ||
40 | } | 36 | } |
41 | 37 | ||
42 | linebuf[idx] = ch; | 38 | linebuf[idx] = ch; |