Hi,
On Sat, 26 Jul 2008, Miklos Vajna wrote:
+ memset(¬_strategies, 0, sizeof(struct cmdnames));
+ for (i = 0; i < main_cmds.cnt; i++) {
Looking through all the discovered git commands? Cute... But does that
not exclude the commands that are in PATH, starting with git-merge-, even
if they are custom strategies?
+ int j, found = 0;
+ for (j = 0; j < ARRAY_SIZE(all_strategy); j++)
+ if (!strcmp(main_cmds.names[i]->name, all_strategy[j].name))
+ found = 1;
+ if (!found)
+ add_cmdname(¬_strategies, main_cmds.names[i]->name, strlen(main_cmds.names[i]->name));
Better have a local variable "name" instead of writing out
"main_cmds.names[i]->name" all the time...
Oh, and you assume that the names are NUL-terminated (which I assume is
not the case in general, as the len member is the only thing that makes
struct cmdnames different from struct string_list.
Ciao,
Dscho