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

[PATCH 4/9] vcs-svn: use constcmp instead of prefixcmp

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jul 6, 2012, 17:18 UTC
Message-ID
<20120706171838.GE31001@burratino>
In-Reply-To
<20120706171040.GA31001@burratino>
From: David Barr <davidbarr@google.com>
Date: Fri, 1 Jun 2012 00:41:27 +1000

Since the length of t is already known, we can simplify a little by using memcmp() instead of strncmp() to carry out a prefix comparison. All nearby code already does this.

Noticed in the standalone svn-dump-fast-export project which has not needed to implement prefixcmp() yet.

Signed-off-by: David Barr <davidbarr@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Description clarified.  No other change.
 vcs-svn/svndump.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index f6c0d4c8..c5d07a66 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -361,7 +361,7 @@ void svndump_read(const char *url)
 			reset_rev_ctx(atoi(val));
 			break;
 		case sizeof("Node-path"):
-			if (prefixcmp(t, "Node-"))
+			if (constcmp(t, "Node-"))
 				continue;
 			if (!constcmp(t + strlen("Node-"), "path")) {
 				if (active_ctx == NODE_CTX)
-- 
1.7.10.4
Previous: Jonathan NiederNext: Jonathan Nieder
Message 9 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.