[PATCH] Remove bogus warning in submodule link code

Lars Hjemli hjemli at gmail.com
Mon Jun 20 20:31:46 CEST 2011

On Thu, Jun 16, 2011 at 16:42, Dan McGee <dpmcgee at gmail.com> wrote:
> In reality, len should ever be unset here if the conditions are right,
> but there is insufficient info for the compiler to realize this so it
> spits an error. Initialize len so gcc doesn't spit an error.

Thanks. I've applied your patch, but moved the initialization out of
the declaration block:

--- a/ui-shared.c
+++ b/ui-shared.c
@@ -525,7 +525,7 @@ void cgit_submodule_link(
 	char tail, *dir;
 	size_t len;

-	tail = 0;
+	len = tail = 0;
 	list = &ctx.repo->submodules;
 	item = lookup_path(list, path);
 	if (!item) {


More information about the CGit mailing list