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

Re: [PATCH v2 3/6] vcs-svn: prefer constcmp to prefixcmp

From
David Michael Barr <davidbarr@google.com>
Date
Jun 1, 2012, 16:43 UTC
Message-ID
<CAFfmPPN1w+h06sYyEBrVsBy0dmKzh0audDMEZHww21tH2Yy0Fw@mail.gmail.com>
In-Reply-To
<7vfwaf3sll.fsf@alter.siamese.dyndns.org>
On Sat, Jun 2, 2012 at 2:27 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
> David Barr <davidbarr@google.com> writes:
>
>> Comparisons in svndump.c are always guarded by length.
>> As a bonus, elimate dependency on prefixcmp for upstream.
>>
>> Signed-off-by: David Barr <davidbarr@google.com>
>
> It feels suboptimal, from cross-project maintenance point of view,
> that "do not use prefixcmp() in the source in this directory" has to
> be an unwritten rule.  Is there something we can do better to avoid
> having to apply a patch like this in the future?

I should note that constcmp() is local to vcs-svn/svndump.c. In this particular case, using prefixcmp() was a departure from the style of the surrounding code.

Should prefixcmp() be referenced outside svndump_read() and handle_property(), I'll handle the dependency upstream.

Show 16 quoted lines
>>  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 0899790..8d0ae9c 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)

-- David Barr

Previous: Junio C HamanoNext: David Barr
Message 6 of 10 in “vcs-svn: housekeeping”
  1. 0/6 vcs-svn: housekeepingDavid Barr, May 31, 2012
  2. 1/6 vcs-svn: fix clang-analyzer errorDavid Barr, May 31, 2012
  3. 2/6 vcs-svn: simplify cleanup in apply_one_window()David Barr, May 31, 2012
  4. 3/6 vcs-svn: prefer constcmp to prefixcmpDavid Barr, May 31, 2012
  5. Junio C HamanoJun 1, 2012
  6. David Michael BarrJun 1, 2012
  7. 4/6 vcs-svn: prefer strstr over memmemDavid Barr, May 31, 2012
  8. 5/6 vcs-svn: fix signedness warningsDavid Barr, May 31, 2012
  9. 6/6 vcs-svn: drop no-op reset methodsDavid Barr, May 31, 2012
  10. David Michael BarrJun 1, 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.