index-pack: correct --keep[=<msg>]
[gitweb.git] / help.c
diff --git a/help.c b/help.c
index b266b09320c067221eb4fffa56e4778d5f8b3a9e..97567c452364838ea720fc8f61d2e9ab96304613 100644 (file)
--- a/help.c
+++ b/help.c
@@ -145,7 +145,7 @@ static void list_commands_in_dir(struct cmdnames *cmds,
        len = buf.len;
 
        while ((de = readdir(dir)) != NULL) {
-               int entlen;
+               size_t entlen;
 
                if (!starts_with(de->d_name, prefix))
                        continue;
@@ -156,8 +156,7 @@ static void list_commands_in_dir(struct cmdnames *cmds,
                        continue;
 
                entlen = strlen(de->d_name) - prefix_len;
-               if (has_extension(de->d_name, ".exe"))
-                       entlen -= 4;
+               strip_suffix(de->d_name, ".exe", &entlen);
 
                add_cmdname(cmds, de->d_name + prefix_len, entlen);
        }