projects
/
platform
/
upstream
/
kmod.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
211e384
)
util: remove dead code in freadline_wrapped
author
Caio Marcelo de Oliveira Filho
<caio.oliveira@intel.com>
Wed, 21 Jan 2015 11:37:23 +0000
(09:37 -0200)
committer
Lucas De Marchi
<lucas.demarchi@intel.com>
Wed, 21 Jan 2015 12:18:44 +0000
(10:18 -0200)
Each loop iteration starts with 'i < size'. When i is changed
the invariant is kept by checking if 'i == size' and growing the
buffer.
shared/util.c
patch
|
blob
|
history
diff --git
a/shared/util.c
b/shared/util.c
index
479f0fe
..
1a2b17c
100644
(file)
--- 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)