summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7e2fe3a)
raw | patch | inline | side by side (parent: 7e2fe3a)
author | Jonathan Nieder <jrnieder@gmail.com> | |
Fri, 25 Mar 2011 04:10:00 +0000 (23:10 -0500) | ||
committer | Jonathan Nieder <jrnieder@gmail.com> | |
Sat, 26 Mar 2011 05:41:38 +0000 (00:41 -0500) |
Use strbuf_swap when storing the svn:log and svn:author properties, so
pointers to rather than the contents of buffers get copied. The main
effect should be to make the code a little easier to read.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
pointers to rather than the contents of buffers get copied. The main
effect should be to make the code a little easier to read.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
vcs-svn/svndump.c | patch | blob | history |
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index c00f031179702ff4dd96696e79a9274322967c44..88ecef1066efe3e1d0a6a6d7a08f691321095297 100644 (file)
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
}
static void handle_property(const struct strbuf *key_buf,
- const char *val, uint32_t len,
+ struct strbuf *val,
uint32_t *type_set)
{
const char *key = key_buf->buf;
break;
if (!val)
die("invalid dump: unsets svn:log");
- strbuf_reset(&rev_ctx.log);
- strbuf_add(&rev_ctx.log, val, len);
+ strbuf_swap(&rev_ctx.log, val);
break;
case sizeof("svn:author"):
if (constcmp(key, "svn:author"))
break;
- strbuf_reset(&rev_ctx.author);
- if (val)
- strbuf_add(&rev_ctx.author, val, len);
+ if (!val)
+ strbuf_reset(&rev_ctx.author);
+ else
+ strbuf_swap(&rev_ctx.author, val);
break;
case sizeof("svn:date"):
if (constcmp(key, "svn:date"))
break;
if (!val)
die("invalid dump: unsets svn:date");
- if (parse_date_basic(val, &rev_ctx.timestamp, NULL))
- warning("invalid timestamp: %s", val);
+ if (parse_date_basic(val->buf, &rev_ctx.timestamp, NULL))
+ warning("invalid timestamp: %s", val->buf);
break;
case sizeof("svn:executable"):
case sizeof("svn:special"):
strbuf_swap(&key, &val);
continue;
case 'D':
- handle_property(&val, NULL, 0, &type_set);
+ handle_property(&val, NULL, &type_set);
continue;
case 'V':
- handle_property(&key, val.buf, len, &type_set);
+ handle_property(&key, &val, &type_set);
strbuf_reset(&key);
continue;
default: