Code

Fix uninitialized variable in string_expand_length
authorJeff King <peff@peff.net>
Sat, 7 Feb 2009 10:37:23 +0000 (05:37 -0500)
committerJonas Fonseca <fonseca@diku.dk>
Sat, 7 Feb 2009 14:23:52 +0000 (15:23 +0100)
This led to totally unpredictable results from the function. The style
matches the loop in string_expand.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
tig.c

diff --git a/tig.c b/tig.c
index 79afdb1a11f8ab83dba1b7129c21b102fb42533a..97794b0e6e0d85793b678537aff32e65902c5fe7 100644 (file)
--- 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