On Sun, May 6, 2012 at 4:12 PM, Jeff King <peff@xxxxxxxx> wrote: > So this shorter patch should be sufficient (though I didn't actually > test it): Tested and works fine. > diff --git a/help.c b/help.c > index 69d483d..d3868b3 100644 > --- a/help.c > +++ b/help.c > @@ -43,9 +43,12 @@ static void uniq(struct cmdnames *cmds) > if (!cmds->cnt) > return; > > - for (i = j = 1; i < cmds->cnt; i++) > - if (strcmp(cmds->names[i]->name, cmds->names[i-1]->name)) > + for (i = j = 1; i < cmds->cnt; i++) { > + if (!strcmp(cmds->names[i]->name, cmds->names[j-1]->name)) > + free(cmds->names[i]); > + else > cmds->names[j++] = cmds->names[i]; > + } > > cmds->cnt = j; > } Not only is this better than mine in terms of readability, it is better than the original code. -- Cheers, Ray Chuan -- 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