diff options
author | Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com> | 2015-01-21 09:37:23 -0200 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2015-01-21 10:18:44 -0200 |
commit | 88f6ffe449fc1c92725615348b63c4b59bb50921 (patch) | |
tree | 7f18df56e5c9f0465fc9d4d088433277c396f4b4 /shared | |
parent | 211e3840fc53d001fe829ae08676b6ec6cfa07a6 (diff) | |
download | kmod-88f6ffe449fc1c92725615348b63c4b59bb50921.tar.gz kmod-88f6ffe449fc1c92725615348b63c4b59bb50921.tar.bz2 kmod-88f6ffe449fc1c92725615348b63c4b59bb50921.zip |
util: remove dead code in freadline_wrapped
Each loop iteration starts with 'i < size'. When i is changed
the invariant is kept by checking if 'i == size' and growing the
buffer.
Diffstat (limited to 'shared')
-rw-r--r-- | shared/util.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/shared/util.c b/shared/util.c index 479f0fe..1a2b17c 100644 --- a/shared/util.c +++ b/shared/util.c @@ -314,13 +314,7 @@ char *freadline_wrapped(FILE *fp, unsigned int *linenum) n++; { - char *ret; - if (i == size) { - ret = realloc(buf, size + 1); - if (!ret) - return NULL; - } else - ret = buf; + char *ret = buf; ret[i] = '\0'; buf = NULL; if (linenum) |