From: Ramsay Jones Date: Sun, 11 Sep 2011 19:39:32 +0000 (+0100) Subject: Fix some "variable might be used uninitialized" warnings X-Git-Tag: v1.7.8-rc0~116 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=27c0f768843b6d844674f1fb8dc2676d830b56e3;p=git.git Fix some "variable might be used uninitialized" warnings In particular, gcc complains as follows: CC tree-walk.o tree-walk.c: In function `traverse_trees': tree-walk.c:347: warning: 'e' might be used uninitialized in this \ function CC builtin/revert.o builtin/revert.c: In function `verify_opt_mutually_compatible': builtin/revert.c:113: warning: 'opt2' might be used uninitialized in \ this function Signed-off-by: Ramsay Jones Signed-off-by: Junio C Hamano --- diff --git a/builtin/revert.c b/builtin/revert.c index ba27cf15e..200149e2e 100644 --- a/builtin/revert.c +++ b/builtin/revert.c @@ -110,7 +110,7 @@ static void verify_opt_compatible(const char *me, const char *base_opt, ...) static void verify_opt_mutually_compatible(const char *me, ...) { - const char *opt1, *opt2; + const char *opt1, *opt2 = NULL; va_list ap; va_start(ap, me); diff --git a/tree-walk.c b/tree-walk.c index 808bb55ba..a8d8a66d5 100644 --- a/tree-walk.c +++ b/tree-walk.c @@ -344,7 +344,7 @@ int traverse_trees(int n, struct tree_desc *t, struct traverse_info *info) unsigned long mask, dirmask; const char *first = NULL; int first_len = 0; - struct name_entry *e; + struct name_entry *e = NULL; int len; for (i = 0; i < n; i++) {