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

[PATCH 5/9] vcs-svn: use strstr instead of memmem

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jul 6, 2012, 17:19 UTC
Message-ID
<20120706171950.GF31001@burratino>
In-Reply-To
<20120706171040.GA31001@burratino>
From: David Barr <davidbarr@google.com>
Date: Fri, 1 Jun 2012 00:41:28 +1000
memmem is a GNU extension.

Avoiding it makes the code clearer and makes it easier for projects that don't share git's compat/ code, such as the standalone svn-dump-fast-export project, to reuse the vcs-svn/ library.

Signed-off-by: David Barr <davidbarr@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Clarified description.  No other change since v2.
 vcs-svn/fast_export.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c
index b4be91cc..854b328d 100644
--- a/vcs-svn/fast_export.c
+++ b/vcs-svn/fast_export.c
@@ -158,7 +158,7 @@ static int parse_cat_response_line(const char *header, off_t *len)
 
 	if (ends_with(header, headerlen, " missing"))
 		return error("cat-blob reports missing blob: %s", header);
-	type = memmem(header, headerlen, " blob ", strlen(" blob "));
+	type = strstr(header, " blob ");
 	if (!type)
 		return error("cat-blob header has wrong object type: %s", header);
 	n = strtoumax(type + strlen(" blob "), (char **) &end, 10);
-- 
1.7.10.4
Previous: Jonathan NiederNext: Jonathan Nieder
Message 10 of 16 in “What's cooking in git.git (Jun 2012, #02; Wed, 6)”
  1. Junio C HamanoJun 6, 2012
  2. David Michael BarrJun 6, 2012
  3. Jonathan NiederJun 7, 2012
  4. Junio C HamanoJun 7, 2012
  5. [GIT PULL] vcs-svn housekeepingJonathan Nieder, Jul 6, 2012
  6. 1/9 vcs-svn: drop no-op reset methodsJonathan Nieder, Jul 6, 2012
  7. 2/9 vcs-svn: avoid self-assignment in dummy initialization of pre_offJonathan Nieder, Jul 6, 2012
  8. 3/9 vcs-svn: simplify cleanup in apply_one_windowJonathan Nieder, Jul 6, 2012
  9. 4/9 vcs-svn: use constcmp instead of prefixcmpJonathan Nieder, Jul 6, 2012
  10. 5/9 vcs-svn: use strstr instead of memmemJonathan Nieder, Jul 6, 2012
  11. 6/9 vcs-svn: suppress signed/unsigned comparison warningsJonathan Nieder, Jul 6, 2012
  12. 7/9 vcs-svn: suppress a signed/unsigned comparison warningJonathan Nieder, Jul 6, 2012
  13. 8/9 vcs-svn: suppress a signed/unsigned comparison warningJonathan Nieder, Jul 6, 2012
  14. 9/9 vcs-svn: allow 64-bit Prop-Content-LengthJonathan Nieder, Jul 6, 2012
  15. David Michael BarrJul 6, 2012
  16. Junio C HamanoJul 6, 2012

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.