while ((de = readdir(dir)) != NULL) {
const char *ent;
- int entlen;
+ size_t entlen;
if (!skip_prefix(de->d_name, prefix, &ent))
continue;
continue;
entlen = strlen(ent);
- if (has_extension(ent, ".exe"))
- entlen -= 4;
+ strip_suffix(ent, ".exe", &entlen);
add_cmdname(cmds, ent, entlen);
}
add_cmd_list(&main_cmds, &aliases);
add_cmd_list(&main_cmds, &other_cmds);
qsort(main_cmds.names, main_cmds.cnt,
- sizeof(main_cmds.names), cmdname_compare);
+ sizeof(*main_cmds.names), cmdname_compare);
uniq(&main_cmds);
/* This abuses cmdname->len for levenshtein distance */