strbuf: remove unnecessary NUL assignment in xstrdup_tolower()
authorLars Schneider <larsxschneider@gmail.com>
Thu, 15 Feb 2018 15:27:05 +0000 (16:27 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 15 Feb 2018 19:36:15 +0000 (11:36 -0800)
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: Junio C Hamano <gitster@pobox.com>
strbuf.c
index 8007be8fbafdc3f4542e27cfc9344044f71d43dc..490f7850e963b8171032986ae18e7c3491115b40 100644 (file)
--- 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;
 }