[PATCH v5 1/7] strbuf: remove unnecessary NUL assignment in xstrdup_tolower()
- From
tboegi@web.de <tboegi@web.de>
- Date
- Jan 29, 2018, 20:18 UTC
- Message-ID
- <20180129201859.9226-1-tboegi@web.de>
- In-Reply-To
- <xmqqshawfgaa.fsf@gitster.mtv.corp.google.com>
From: Lars Schneider <larsxschneider@gmail.com>
Since 3733e69464 (use xmallocz to avoid size arithmetic, 2016-02-22) we allocate the buffer for the lower case string with xmallocz(). This already ensures a NUL at the end of the allocated buffer.
Remove the unnecessary assignment.
Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Signed-off-by: Torsten Bögershausen <tboegi@web.de> --- strbuf.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/strbuf.c b/strbuf.c index 8007be8fb..490f7850e 100644 --- a/strbuf.c +++ b/strbuf.c @@ -781,7 +781,6 @@ char *xstrdup_tolower(const char *string) result = xmallocz(len); for (i = 0; i < len; i++) result[i] = tolower(string[i]); - result[i] = '\0'; return result; }
-- 2.16.0.rc0.2.g64d3e4d0cc.dirty