Skip to contentSkip to conversation

strbuf.c: remove unnecessary strbuf_grow() from strbuf_getwholeline()

PATCH New Brandon Casey 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 strbuf.c: remove unnecessary strbuf_grow() from strbuf_getwholeline()

This use of strbuf_grow() is a historical artifact that was once used to ensure that strbuf.buf was allocated and properly nul-terminated. This was added before the introduction of the slopbuf in b315c5c0, which guarantees that strbuf.buf always points to a usable nul-terminated string. So let's remove it.

---
 strbuf.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
strbuf.c +0 -1
index 9ff1b59..3ad2cc0 100644
@@ -357,7 +357,6 @@ int strbuf_getwholeline(struct strbuf *sb, FILE *fp, int term)
 {
 	int ch;
 
-	strbuf_grow(sb, 0);
 	if (feof(fp))
 		return EOF;
 
Signature · 1 line
1.7.7.1.ge3b6f