git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] help: Fix size passed to qsort

From
Stefan Beller <stefanbeller@gmail.com>
Date
Sep 17, 2014, 12:14 UTC
Message-ID
<1410956079-23513-1-git-send-email-stefanbeller@gmail.com>

We actually want to have the size of one 'name' and not the size of the names array.

Signed-off-by: Stefan Beller <stefanbeller@gmail.com>
---
 help.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/help.c b/help.c
index 7af65e2..2072a87 100644
--- a/help.c
+++ b/help.c
@@ -305,7 +305,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 abuses cmdname->len for levenshtein distance */
-- 
2.1.0.238.gce1d3a9
Next: Junio C Hamano
Message 1 of 3 in “help: Fix size passed to qsort”
  1. help: Fix size passed to qsortStefan Beller, Sep 17, 2014
  2. Junio C HamanoSep 18, 2014
  3. Junio C HamanoSep 18, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.