git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix uninitialized variable in string_expand_length
@ 2009-02-07 10:37 Jeff King
  2009-02-08  9:58 ` Jonas Fonseca
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff King @ 2009-02-07 10:37 UTC (permalink / raw)
  To: Jonas Fonseca; +Cc: git

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>
---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-02-08 10:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-07 10:37 [PATCH] fix uninitialized variable in string_expand_length Jeff King
2009-02-08  9:58 ` Jonas Fonseca

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).