[PATCH] fix uninitialized variable in string_expand_length

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This led to totally unpredictable results from the function. The style
matches the loop in string_expand.

Signed-off-by: Jeff King <peff@xxxxxxxx>
---
 tig.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tig.c b/tig.c
index 79afdb1..97794b0 100644
--- a/tig.c
+++ b/tig.c
@@ -193,7 +193,7 @@ string_expand_length(const char *line, int tabsize)
 {
 	size_t size, pos;
 
-	for (pos = 0; line[pos]; pos++) {
+	for (size = pos = 0; line[pos]; pos++) {
 		if (line[pos] == '\t' && tabsize > 0)
 			size += tabsize - (size % tabsize);
 		else
-- 
1.6.1.2.552.g1682c.dirty
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux