{"thread":{"id":"30672","subject":"[PATCH v2 0/6] vcs-svn: housekeeping","startedAt":"2012-05-31T14:41:24Z","lastAt":"2012-06-01T16:43:02Z","messageCount":10,"participants":["David Barr","David Michael Barr","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":6},"messages":[{"id":"192584","messageId":"1338475290-22644-1-git-send-email-davidbarr@google.com","threadId":"30672","inReplyTo":null,"subject":"[PATCH v2 0/6] vcs-svn: housekeeping","fromName":"David Barr","fromEmail":"davidbarr@google.com","sentAt":"2012-05-31T14:41:24Z","receivedAt":"2012-05-31T14:41:24Z","isPatch":true,"sender":{"key":"davidbarr@google.com","avatar":"https://avatars.githubusercontent.com/u/220594?v=4"},"body":"I've begun to upstream the changes made in the git fork\nof svn-dump-fast-export in vcs-svn back to the original\nproject. This series contains the fixups I needed to\ncompile without errors or warnings and pass static\nanalysis.\n\nThis second attempt addresses Jonathan's comments.\nI've tidied the upstream history in preparation to\nmerge this series back if it is accepted.\n\n--\nDavid Barr\n"},{"id":"192585","messageId":"1338475290-22644-2-git-send-email-davidbarr@google.com","threadId":"30672","inReplyTo":"1338475290-22644-1-git-send-email-davidbarr@google.com","subject":"[PATCH v2 1/6] vcs-svn: fix clang-analyzer error","fromName":"David Barr","fromEmail":"davidbarr@google.com","sentAt":"2012-05-31T14:41:25Z","receivedAt":"2012-05-31T14:41:25Z","isPatch":true,"sender":{"key":"davidbarr@google.com","avatar":"https://avatars.githubusercontent.com/u/220594?v=4"},"body":"vcs-svn/svndiff.c:298:3: warning: Assigned value is garbage or undefined\n                off_t pre_off = pre_off; /* stupid GCC... */\n                ^               ~~~~~~~\n\nSigned-off-by: David Barr <davidbarr@google.com>\n---\n vcs-svn/svndiff.c |    2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/vcs-svn/svndiff.c b/vcs-svn/svndiff.c\nindex 1647c1a..57d647d 100644\n--- a/vcs-svn/svndiff.c\n+++ b/vcs-svn/svndiff.c\n@@ -295,7 +295,7 @@ int svndiff0_apply(struct line_buffer *delta, off_t delta_len,\n \tif (read_magic(delta, &delta_len))\n \t\treturn -1;\n \twhile (delta_len) {\t/* For each window: */\n-\t\toff_t pre_off = pre_off; /* stupid GCC... */\n+\t\toff_t pre_off = 0; /* stupid GCC and clang-analyzer... */\n \t\tsize_t pre_len;\n \n \t\tif (read_offset(delta, &pre_off, &delta_len) ||\n-- \n1.7.10.2\n"},{"id":"192586","messageId":"1338475290-22644-3-git-send-email-davidbarr@google.com","threadId":"30672","inReplyTo":"1338475290-22644-1-git-send-email-davidbarr@google.com","subject":"[PATCH v2 2/6] vcs-svn: simplify cleanup in apply_one_window()","fromName":"David Barr","fromEmail":"davidbarr@google.com","sentAt":"2012-05-31T14:41:26Z","receivedAt":"2012-05-31T14:41:26Z","isPatch":true,"sender":{"key":"davidbarr@google.com","avatar":"https://avatars.githubusercontent.com/u/220594?v=4"},"body":"As a side-effect, fix clang-analyzer warning:\n\nvcs-svn/svndiff.c:278:3: warning: expression result unused [-Wunused-value]\n                error(\"invalid delta: incorrect postimage length\");\n                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThis warning caused by an insanely concise error() upstream.\n\nSigned-off-by: David Barr <davidbarr@google.com>\n---\n vcs-svn/svndiff.c |    8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/vcs-svn/svndiff.c b/vcs-svn/svndiff.c\nindex 57d647d..11a0e38 100644\n--- a/vcs-svn/svndiff.c\n+++ b/vcs-svn/svndiff.c\n@@ -258,6 +258,7 @@ static int apply_window_in_core(struct window *ctx)\n static int apply_one_window(struct line_buffer *delta, off_t *delta_len,\n \t\t\t    struct sliding_view *preimage, FILE *out)\n {\n+\tint rv = -1;\n \tstruct window ctx = WINDOW_INIT(preimage);\n \tsize_t out_len;\n \tsize_t instructions_len;\n@@ -275,16 +276,15 @@ static int apply_one_window(struct line_buffer *delta, off_t *delta_len,\n \tif (apply_window_in_core(&ctx))\n \t\tgoto error_out;\n \tif (ctx.out.len != out_len) {\n-\t\terror(\"invalid delta: incorrect postimage length\");\n+\t\trv = error(\"invalid delta: incorrect postimage length\");\n \t\tgoto error_out;\n \t}\n \tif (write_strbuf(&ctx.out, out))\n \t\tgoto error_out;\n-\twindow_release(&ctx);\n-\treturn 0;\n+\trv = 0;\n error_out:\n \twindow_release(&ctx);\n-\treturn -1;\n+\treturn rv;\n }\n \n int svndiff0_apply(struct line_buffer *delta, off_t delta_len,\n-- \n1.7.10.2\n"},{"id":"192587","messageId":"1338475290-22644-4-git-send-email-davidbarr@google.com","threadId":"30672","inReplyTo":"1338475290-22644-1-git-send-email-davidbarr@google.com","subject":"[PATCH v2 3/6] vcs-svn: prefer constcmp to prefixcmp","fromName":"David Barr","fromEmail":"davidbarr@google.com","sentAt":"2012-05-31T14:41:27Z","receivedAt":"2012-05-31T14:41:27Z","isPatch":true,"sender":{"key":"davidbarr@google.com","avatar":"https://avatars.githubusercontent.com/u/220594?v=4"},"body":"Comparisons in svndump.c are always guarded by length.\nAs a bonus, elimate dependency on prefixcmp for upstream.\n\nSigned-off-by: David Barr <davidbarr@google.com>\n---\n vcs-svn/svndump.c |    2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c\nindex 0899790..8d0ae9c 100644\n--- a/vcs-svn/svndump.c\n+++ b/vcs-svn/svndump.c\n@@ -361,7 +361,7 @@ void svndump_read(const char *url)\n \t\t\treset_rev_ctx(atoi(val));\n \t\t\tbreak;\n \t\tcase sizeof(\"Node-path\"):\n-\t\t\tif (prefixcmp(t, \"Node-\"))\n+\t\t\tif (constcmp(t, \"Node-\"))\n \t\t\t\tcontinue;\n \t\t\tif (!constcmp(t + strlen(\"Node-\"), \"path\")) {\n \t\t\t\tif (active_ctx == NODE_CTX)\n-- \n1.7.10.2\n"},{"id":"192588","messageId":"1338475290-22644-5-git-send-email-davidbarr@google.com","threadId":"30672","inReplyTo":"1338475290-22644-1-git-send-email-davidbarr@google.com","subject":"[PATCH v2 4/6] vcs-svn: prefer strstr over memmem","fromName":"David Barr","fromEmail":"davidbarr@google.com","sentAt":"2012-05-31T14:41:28Z","receivedAt":"2012-05-31T14:41:28Z","isPatch":true,"sender":{"key":"davidbarr@google.com","avatar":"https://avatars.githubusercontent.com/u/220594?v=4"},"body":"The common pattern is to use strstr to match a fixed needle.\nAs a bonus, elimate dependency on memmem for upstream.\n\nSigned-off-by: David Barr <davidbarr@google.com>\n---\n vcs-svn/fast_export.c |    2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c\nindex b823b85..cda37dd 100644\n--- a/vcs-svn/fast_export.c\n+++ b/vcs-svn/fast_export.c\n@@ -163,7 +163,7 @@ static int parse_cat_response_line(const char *header, off_t *len)\n \n \tif (ends_with(header, headerlen, \" missing\"))\n \t\treturn error(\"cat-blob reports missing blob: %s\", header);\n-\ttype = memmem(header, headerlen, \" blob \", strlen(\" blob \"));\n+\ttype = strstr(header, \" blob \");\n \tif (!type)\n \t\treturn error(\"cat-blob header has wrong object type: %s\", header);\n \tn = strtoumax(type + strlen(\" blob \"), (char **) &end, 10);\n-- \n1.7.10.2\n"},{"id":"192589","messageId":"1338475290-22644-6-git-send-email-davidbarr@google.com","threadId":"30672","inReplyTo":"1338475290-22644-1-git-send-email-davidbarr@google.com","subject":"[PATCH v2 5/6] vcs-svn: fix signedness warnings","fromName":"David Barr","fromEmail":"davidbarr@google.com","sentAt":"2012-05-31T14:41:29Z","receivedAt":"2012-05-31T14:41:29Z","isPatch":true,"sender":{"key":"davidbarr@google.com","avatar":"https://avatars.githubusercontent.com/u/220594?v=4"},"body":"Stop mixing off_t and size_t.\n\nSigned-off-by: David Barr <davidbarr@google.com>\n---\n vcs-svn/fast_export.c    |    4 ++--\n vcs-svn/sliding_window.c |    2 +-\n vcs-svn/svndiff.c        |    2 +-\n vcs-svn/svndump.c        |    4 ++--\n 4 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c\nindex cda37dd..6ded98b 100644\n--- a/vcs-svn/fast_export.c\n+++ b/vcs-svn/fast_export.c\n@@ -259,7 +259,7 @@ static int parse_ls_response(const char *response, uint32_t *mode,\n \t}\n \n \t/* Mode. */\n-\tif (response_end - response < strlen(\"100644\") ||\n+\tif (response_end - response < (signed) strlen(\"100644\") ||\n \t    response[strlen(\"100644\")] != ' ')\n \t\tdie(\"invalid ls response: missing mode: %s\", response);\n \t*mode = 0;\n@@ -272,7 +272,7 @@ static int parse_ls_response(const char *response, uint32_t *mode,\n \t}\n \n \t/* ' blob ' or ' tree ' */\n-\tif (response_end - response < strlen(\" blob \") ||\n+\tif (response_end - response < (signed) strlen(\" blob \") ||\n \t    (response[1] != 'b' && response[1] != 't'))\n \t\tdie(\"unexpected ls response: not a tree or blob: %s\", response);\n \tresponse += strlen(\" blob \");\ndiff --git a/vcs-svn/sliding_window.c b/vcs-svn/sliding_window.c\nindex ec2707c..f11d490 100644\n--- a/vcs-svn/sliding_window.c\n+++ b/vcs-svn/sliding_window.c\n@@ -54,7 +54,7 @@ int move_window(struct sliding_view *view, off_t off, size_t width)\n \t\treturn -1;\n \tif (off < view->off || off + width < view->off + view->width)\n \t\treturn error(\"invalid delta: window slides left\");\n-\tif (view->max_off >= 0 && view->max_off < off + width)\n+\tif (view->max_off >= 0 && view->max_off < off + (off_t) width)\n \t\treturn error(\"delta preimage ends early\");\n \n \tfile_offset = view->off + view->buf.len;\ndiff --git a/vcs-svn/svndiff.c b/vcs-svn/svndiff.c\nindex 11a0e38..f061fae 100644\n--- a/vcs-svn/svndiff.c\n+++ b/vcs-svn/svndiff.c\n@@ -78,7 +78,7 @@ static int read_chunk(struct line_buffer *delta, off_t *delta_len,\n \t\t      struct strbuf *buf, size_t len)\n {\n \tstrbuf_reset(buf);\n-\tif (len > *delta_len ||\n+\tif ((off_t) len > *delta_len ||\n \t    buffer_read_binary(delta, buf, len) != len)\n \t\treturn error_short_read(delta);\n \t*delta_len -= buf->len;\ndiff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c\nindex 8d0ae9c..6d1e3cd 100644\n--- a/vcs-svn/svndump.c\n+++ b/vcs-svn/svndump.c\n@@ -40,8 +40,8 @@\n static struct line_buffer input = LINE_BUFFER_INIT;\n \n static struct {\n-\tuint32_t action, propLength, srcRev, type;\n-\toff_t text_length;\n+\tuint32_t action, srcRev, type;\n+\toff_t propLength, text_length;\n \tstruct strbuf src, dst;\n \tuint32_t text_delta, prop_delta;\n } node_ctx;\n-- \n1.7.10.2\n"},{"id":"192590","messageId":"1338475290-22644-7-git-send-email-davidbarr@google.com","threadId":"30672","inReplyTo":"1338475290-22644-1-git-send-email-davidbarr@google.com","subject":"[PATCH v2 6/6] vcs-svn: drop no-op reset methods","fromName":"David Barr","fromEmail":"davidbarr@google.com","sentAt":"2012-05-31T14:41:30Z","receivedAt":"2012-05-31T14:41:30Z","isPatch":true,"sender":{"key":"davidbarr@google.com","avatar":"https://avatars.githubusercontent.com/u/220594?v=4"},"body":"Since v1.7.5~42^2~6 (vcs-svn: remove buffer_read_string)\nbuffer_reset() does nothing thus fast_export_reset() also.\n\nSigned-off-by: David Barr <davidbarr@google.com>\n---\n vcs-svn/fast_export.c |    5 -----\n vcs-svn/fast_export.h |    1 -\n vcs-svn/line_buffer.c |    4 ----\n vcs-svn/line_buffer.h |    1 -\n vcs-svn/svndump.c     |    2 --\n 5 files changed, 13 deletions(-)\n\ndiff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c\nindex 6ded98b..1f04697 100644\n--- a/vcs-svn/fast_export.c\n+++ b/vcs-svn/fast_export.c\n@@ -42,11 +42,6 @@ void fast_export_deinit(void)\n \t\tdie_errno(\"error closing fast-import feedback stream\");\n }\n \n-void fast_export_reset(void)\n-{\n-\tbuffer_reset(&report_buffer);\n-}\n-\n void fast_export_delete(const char *path)\n {\n \tputchar('D');\ndiff --git a/vcs-svn/fast_export.h b/vcs-svn/fast_export.h\nindex aa629f5..8823aca 100644\n--- a/vcs-svn/fast_export.h\n+++ b/vcs-svn/fast_export.h\n@@ -6,7 +6,6 @@ struct line_buffer;\n \n void fast_export_init(int fd);\n void fast_export_deinit(void);\n-void fast_export_reset(void);\n \n void fast_export_delete(const char *path);\n void fast_export_modify(const char *path, uint32_t mode, const char *dataref);\ndiff --git a/vcs-svn/line_buffer.c b/vcs-svn/line_buffer.c\nindex 01fcb84..57cc1ce 100644\n--- a/vcs-svn/line_buffer.c\n+++ b/vcs-svn/line_buffer.c\n@@ -124,7 +124,3 @@ off_t buffer_skip_bytes(struct line_buffer *buf, off_t nbytes)\n \t}\n \treturn done;\n }\n-\n-void buffer_reset(struct line_buffer *buf)\n-{\n-}\ndiff --git a/vcs-svn/line_buffer.h b/vcs-svn/line_buffer.h\nindex 8901f21..ee23b4f 100644\n--- a/vcs-svn/line_buffer.h\n+++ b/vcs-svn/line_buffer.h\n@@ -14,7 +14,6 @@ struct line_buffer {\n int buffer_init(struct line_buffer *buf, const char *filename);\n int buffer_fdinit(struct line_buffer *buf, int fd);\n int buffer_deinit(struct line_buffer *buf);\n-void buffer_reset(struct line_buffer *buf);\n \n int buffer_tmpfile_init(struct line_buffer *buf);\n FILE *buffer_tmpfile_rewind(struct line_buffer *buf);\t/* prepare to write. */\ndiff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c\nindex 6d1e3cd..f1705f3 100644\n--- a/vcs-svn/svndump.c\n+++ b/vcs-svn/svndump.c\n@@ -499,8 +499,6 @@ void svndump_deinit(void)\n \n void svndump_reset(void)\n {\n-\tfast_export_reset();\n-\tbuffer_reset(&input);\n \tstrbuf_release(&dump_ctx.uuid);\n \tstrbuf_release(&dump_ctx.url);\n \tstrbuf_release(&rev_ctx.log);\n-- \n1.7.10.2\n"},{"id":"192629","messageId":"CAFfmPPOSLXU1Fcg=xc4OMF2+w6VTYAEL=Jgw+f6dfgxXmuO1rg@mail.gmail.com","threadId":"30672","inReplyTo":"1338475290-22644-7-git-send-email-davidbarr@google.com","subject":"Re: [PATCH v2 6/6] vcs-svn: drop no-op reset methods","fromName":"David Michael Barr","fromEmail":"davidbarr@google.com","sentAt":"2012-06-01T04:26:58Z","receivedAt":"2012-06-01T04:26:58Z","isPatch":true,"sender":{"key":"davidbarr@google.com","avatar":"https://avatars.githubusercontent.com/u/220594?v=4"},"body":"On Fri, Jun 1, 2012 at 12:41 AM, David Barr <davidbarr@google.com> wrote:\n> Since v1.7.5~42^2~6 (vcs-svn: remove buffer_read_string)\n> buffer_reset() does nothing thus fast_export_reset() also.\n>\n> Signed-off-by: David Barr <davidbarr@google.com>\n> ---\n>  vcs-svn/fast_export.c |    5 -----\n>  vcs-svn/fast_export.h |    1 -\n>  vcs-svn/line_buffer.c |    4 ----\n>  vcs-svn/line_buffer.h |    1 -\n>  vcs-svn/svndump.c     |    2 --\n>  5 files changed, 13 deletions(-)\n>\n> diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c\n> index 6ded98b..1f04697 100644\n> --- a/vcs-svn/fast_export.c\n> +++ b/vcs-svn/fast_export.c\n> @@ -42,11 +42,6 @@ void fast_export_deinit(void)\n>                die_errno(\"error closing fast-import feedback stream\");\n>  }\n>\n> -void fast_export_reset(void)\n> -{\n> -       buffer_reset(&report_buffer);\n> -}\n> -\n>  void fast_export_delete(const char *path)\n>  {\n>        putchar('D');\n> diff --git a/vcs-svn/fast_export.h b/vcs-svn/fast_export.h\n> index aa629f5..8823aca 100644\n> --- a/vcs-svn/fast_export.h\n> +++ b/vcs-svn/fast_export.h\n> @@ -6,7 +6,6 @@ struct line_buffer;\n>\n>  void fast_export_init(int fd);\n>  void fast_export_deinit(void);\n> -void fast_export_reset(void);\n>\n>  void fast_export_delete(const char *path);\n>  void fast_export_modify(const char *path, uint32_t mode, const char *dataref);\n> diff --git a/vcs-svn/line_buffer.c b/vcs-svn/line_buffer.c\n> index 01fcb84..57cc1ce 100644\n> --- a/vcs-svn/line_buffer.c\n> +++ b/vcs-svn/line_buffer.c\n> @@ -124,7 +124,3 @@ off_t buffer_skip_bytes(struct line_buffer *buf, off_t nbytes)\n>        }\n>        return done;\n>  }\n> -\n> -void buffer_reset(struct line_buffer *buf)\n> -{\n> -}\n> diff --git a/vcs-svn/line_buffer.h b/vcs-svn/line_buffer.h\n> index 8901f21..ee23b4f 100644\n> --- a/vcs-svn/line_buffer.h\n> +++ b/vcs-svn/line_buffer.h\n> @@ -14,7 +14,6 @@ struct line_buffer {\n>  int buffer_init(struct line_buffer *buf, const char *filename);\n>  int buffer_fdinit(struct line_buffer *buf, int fd);\n>  int buffer_deinit(struct line_buffer *buf);\n> -void buffer_reset(struct line_buffer *buf);\n>\n>  int buffer_tmpfile_init(struct line_buffer *buf);\n>  FILE *buffer_tmpfile_rewind(struct line_buffer *buf);  /* prepare to write. */\n> diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c\n> index 6d1e3cd..f1705f3 100644\n> --- a/vcs-svn/svndump.c\n> +++ b/vcs-svn/svndump.c\n> @@ -499,8 +499,6 @@ void svndump_deinit(void)\n>\n>  void svndump_reset(void)\n>  {\n> -       fast_export_reset();\n> -       buffer_reset(&input);\n>        strbuf_release(&dump_ctx.uuid);\n>        strbuf_release(&dump_ctx.url);\n>        strbuf_release(&rev_ctx.log);\n> --\n> 1.7.10.2\n>\n\nIt' a little embarrassing that I didn't catch this before submitting.\nPlease squash in this fix-up when queueing.\n\n--\ndiff --git a/test-line-buffer.c b/test-line-buffer.c\nindex 7ec9b13..ef1d7ba 100644\n--- a/test-line-buffer.c\n+++ b/test-line-buffer.c\n@@ -87,6 +87,5 @@ int main(int argc, char *argv[])\n \t\tdie(\"input error\");\n \tif (ferror(stdout))\n \t\tdie(\"output error\");\n-\tbuffer_reset(&stdin_buf);\n \treturn 0;\n }\ndiff --git a/test-svn-fe.c b/test-svn-fe.c\nindex 332a5f7..83633a2 100644\n--- a/test-svn-fe.c\n+++ b/test-svn-fe.c\n@@ -31,9 +31,7 @@ static int apply_delta(int argc, char *argv[])\n \t\tdie_errno(\"cannot close preimage\");\n \tif (buffer_deinit(&delta))\n \t\tdie_errno(\"cannot close delta\");\n-\tbuffer_reset(&preimage);\n \tstrbuf_release(&preimage_view.buf);\n-\tbuffer_reset(&delta);\n \treturn 0;\n }\n\n--\nDavid Barr\n"},{"id":"192672","messageId":"7vfwaf3sll.fsf@alter.siamese.dyndns.org","threadId":"30672","inReplyTo":"1338475290-22644-4-git-send-email-davidbarr@google.com","subject":"Re: [PATCH v2 3/6] vcs-svn: prefer constcmp to prefixcmp","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-06-01T16:27:34Z","receivedAt":"2012-06-01T16:27:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Barr <davidbarr@google.com> writes:\n\n> Comparisons in svndump.c are always guarded by length.\n> As a bonus, elimate dependency on prefixcmp for upstream.\n>\n> Signed-off-by: David Barr <davidbarr@google.com>\n\nIt feels suboptimal, from cross-project maintenance point of view,\nthat \"do not use prefixcmp() in the source in this directory\" has to\nbe an unwritten rule.  Is there something we can do better to avoid\nhaving to apply a patch like this in the future?\n\n>  vcs-svn/svndump.c |    2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c\n> index 0899790..8d0ae9c 100644\n> --- a/vcs-svn/svndump.c\n> +++ b/vcs-svn/svndump.c\n> @@ -361,7 +361,7 @@ void svndump_read(const char *url)\n>  \t\t\treset_rev_ctx(atoi(val));\n>  \t\t\tbreak;\n>  \t\tcase sizeof(\"Node-path\"):\n> -\t\t\tif (prefixcmp(t, \"Node-\"))\n> +\t\t\tif (constcmp(t, \"Node-\"))\n>  \t\t\t\tcontinue;\n>  \t\t\tif (!constcmp(t + strlen(\"Node-\"), \"path\")) {\n>  \t\t\t\tif (active_ctx == NODE_CTX)\n"},{"id":"192674","messageId":"CAFfmPPN1w+h06sYyEBrVsBy0dmKzh0audDMEZHww21tH2Yy0Fw@mail.gmail.com","threadId":"30672","inReplyTo":"7vfwaf3sll.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH v2 3/6] vcs-svn: prefer constcmp to prefixcmp","fromName":"David Michael Barr","fromEmail":"davidbarr@google.com","sentAt":"2012-06-01T16:43:02Z","receivedAt":"2012-06-01T16:43:02Z","isPatch":true,"sender":{"key":"davidbarr@google.com","avatar":"https://avatars.githubusercontent.com/u/220594?v=4"},"body":"On Sat, Jun 2, 2012 at 2:27 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> David Barr <davidbarr@google.com> writes:\n>\n>> Comparisons in svndump.c are always guarded by length.\n>> As a bonus, elimate dependency on prefixcmp for upstream.\n>>\n>> Signed-off-by: David Barr <davidbarr@google.com>\n>\n> It feels suboptimal, from cross-project maintenance point of view,\n> that \"do not use prefixcmp() in the source in this directory\" has to\n> be an unwritten rule.  Is there something we can do better to avoid\n> having to apply a patch like this in the future?\n\nI should note that constcmp() is local to vcs-svn/svndump.c.\nIn this particular case, using prefixcmp() was a departure from the\nstyle of the surrounding code.\n\nShould prefixcmp() be referenced outside svndump_read() and\nhandle_property(), I'll handle the dependency upstream.\n\n>>  vcs-svn/svndump.c |    2 +-\n>>  1 file changed, 1 insertion(+), 1 deletion(-)\n>>\n>> diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c\n>> index 0899790..8d0ae9c 100644\n>> --- a/vcs-svn/svndump.c\n>> +++ b/vcs-svn/svndump.c\n>> @@ -361,7 +361,7 @@ void svndump_read(const char *url)\n>>                       reset_rev_ctx(atoi(val));\n>>                       break;\n>>               case sizeof(\"Node-path\"):\n>> -                     if (prefixcmp(t, \"Node-\"))\n>> +                     if (constcmp(t, \"Node-\"))\n>>                               continue;\n>>                       if (!constcmp(t + strlen(\"Node-\"), \"path\")) {\n>>                               if (active_ctx == NODE_CTX)\n\n--\nDavid Barr\n"}]}