diff options
Diffstat (limited to 'alias.c')
-rw-r--r-- | alias.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -5,7 +5,8 @@ static char *alias_val; static int alias_lookup_cb(const char *k, const char *v, void *cb) { - if (!prefixcmp(k, "alias.") && !strcmp(k+6, alias_key)) { + const char *name; + if (skip_prefix(k, "alias.", &name) && !strcmp(name, alias_key)) { if (!v) return config_error_nonbool(k); alias_val = xstrdup(v); @@ -34,7 +35,7 @@ int split_cmdline(char *cmdline, const char ***argv) int src, dst, count = 0, size = 16; char quoted = 0; - *argv = xmalloc(sizeof(char *) * size); + *argv = xmalloc(sizeof(**argv) * size); /* split alias_string */ (*argv)[count++] = cmdline; @@ -45,7 +46,7 @@ int split_cmdline(char *cmdline, const char ***argv) while (cmdline[++src] && isspace(cmdline[src])) ; /* skip */ - ALLOC_GROW(*argv, count+1, size); + ALLOC_GROW(*argv, count + 1, size); (*argv)[count++] = cmdline + dst; } else if (!quoted && (c == '\'' || c == '"')) { quoted = c; @@ -76,12 +77,13 @@ int split_cmdline(char *cmdline, const char ***argv) return -SPLIT_CMDLINE_UNCLOSED_QUOTE; } - ALLOC_GROW(*argv, count+1, size); + ALLOC_GROW(*argv, count + 1, size); (*argv)[count] = NULL; return count; } -const char *split_cmdline_strerror(int split_cmdline_errno) { - return split_cmdline_errors[-split_cmdline_errno-1]; +const char *split_cmdline_strerror(int split_cmdline_errno) +{ + return split_cmdline_errors[-split_cmdline_errno - 1]; } |