Thread (18 messages) flat view 18 messages, 5 authors, 2018-04-15
STALE3084d

Revision v11 of 12 in this series.

Revisions (12)
  1. v2 [diff vs current]
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]
  5. v6 [diff vs current]
  6. v7 [diff vs current]
  7. v8 [diff vs current]
  8. v9 [diff vs current]
  9. v10 [diff vs current]
  10. v11 current
  11. v12 [diff vs current]
  12. v13 [diff vs current]

[PATCH v11 01/10] strbuf: remove unnecessary NUL assignment in xstrdup_tolower()

From: <hidden>
Date: 2018-03-09 17:37:24
Subsystem: the rest · Maintainer: Linus Torvalds

From: Lars Schneider <redacted>

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 <redacted>
---
 strbuf.c | 1 -
 1 file changed, 1 deletion(-)
diff --git a/strbuf.c b/strbuf.c
index 1df674e919..55b7daeb35 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.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help