threads / patch / 28600

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

Subject: [PATCH] strbuf.c: remove unnecessary strbuf_grow() from strbuf_getwholeline()

## tl;dr

One message between Oct 6, 2011 and Oct 6, 2011. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Brandon Casey· Oct 6, 2011, 04:21 UTC · lore

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.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
---
 strbuf.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
Show changes to strbuf.c +0 −1
diff --git a/strbuf.c b/strbuf.c
index 9ff1b59..3ad2cc0 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -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;
 
-- 
1.7.7.1.ge3b6f

← back to recent threads