help: fix the size passed to qsort
authorStefan Beller <stefanbeller@gmail.com>
Wed, 17 Sep 2014 12:14:39 +0000 (14:14 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 18 Sep 2014 17:17:53 +0000 (10:17 -0700)
We actually want to have the size of one 'name' and not the size
of the pointer.

Signed-off-by: Stefan Beller <stefanbeller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
help.c

diff --git a/help.c b/help.c
index fd87bb5..3678d6a 100644 (file)
--- a/help.c
+++ b/help.c
@@ -312,7 +312,7 @@ const char *help_unknown_cmd(const char *cmd)
        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 reuses cmdname->len for similarity index */