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

[PATCH v2 7/7] grep: fix string_list_append calls

From
Julian Phillips <julian@quantumfyre.co.uk>
Date
Jun 25, 2010, 23:41 UTC
Message-ID
<20100625234140.18927.35025.julian@quantumfyre.co.uk>
In-Reply-To
<20100625234110.18927.33169.julian@quantumfyre.co.uk>

This updates string_list_append calls added in the new grep -O functionality to have the string list as the first argument.

Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
---
 builtin/grep.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/builtin/grep.c b/builtin/grep.c
index 0374a76..232cd1c 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -564,7 +564,7 @@ static void append_path(struct grep_opt *opt, const void *data, size_t len)
 
 	if (len == 1 && *(const char *)data == '\0')
 		return;
-	string_list_append(xstrndup(data, len), path_list);
+	string_list_append(path_list, xstrndup(data, len));
 }
 
 static void run_pager(struct grep_opt *opt, const char *prefix)
@@ -1005,7 +1005,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 		opt.null_following_name = 1;
 		opt.output_priv = &path_list;
 		opt.output = append_path;
-		string_list_append(show_in_pager, &path_list);
+		string_list_append(&path_list, show_in_pager);
 		use_threads = 0;
 	}
 
@@ -1080,7 +1080,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 			strbuf_addf(&buf, "+/%s%s",
 					strcmp("less", pager) ? "" : "*",
 					opt.pattern_list->pattern);
-			string_list_append(buf.buf, &path_list);
+			string_list_append(&path_list, buf.buf);
 			strbuf_detach(&buf, NULL);
 		}
 	}
-- 
1.7.0.4
Previous: Julian PhillipsNext: Junio C Hamano
Message 8 of 9 in “Make the string_list API consistent”
  1. 0/7 Make the string_list API consistentJulian Phillips, Jun 25, 2010
  2. 1/7 string_list: Fix argument order for print_string_listJulian Phillips, Jun 25, 2010
  3. 2/7 string_list: Fix argument order for for_each_string_listJulian Phillips, Jun 25, 2010
  4. 3/7 string_list: Fix argument order for string_list_insertJulian Phillips, Jun 25, 2010
  5. 4/7 string_list: Fix argument order for string_list_insert_at_indexJulian Phillips, Jun 25, 2010
  6. 5/7 string_list: Fix argument order for string_list_lookupJulian Phillips, Jun 25, 2010
  7. 6/7 string_list: Fix argument order for string_list_appendJulian Phillips, Jun 25, 2010
  8. 7/7 grep: fix string_list_append callsJulian Phillips, Jun 25, 2010
  9. Junio C HamanoJun 27, 2010

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.