aboutsummaryrefslogtreecommitdiffstats
path: root/test-date.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-09-19 11:38:33 -0700
committerJunio C Hamano <gitster@pobox.com>2014-09-19 11:38:33 -0700
commit9ff700ebacffc8fb8cf80daabfb6503cb24dca0b (patch)
tree63213092f97a3522450c6cbea407b80c37f6c3ca /test-date.c
parentMerge branch 'bb/date-iso-strict' (diff)
parentdetermine_author_info(): copy getenv output (diff)
downloadgit-9ff700ebacffc8fb8cf80daabfb6503cb24dca0b.tar.gz
git-9ff700ebacffc8fb8cf80daabfb6503cb24dca0b.zip
Merge branch 'jk/commit-author-parsing'
Code clean-up. * jk/commit-author-parsing: determine_author_info(): copy getenv output determine_author_info(): reuse parsing functions date: use strbufs in date-formatting functions record_author_date(): use find_commit_header() record_author_date(): fix memory leak on malformed commit commit: provide a function to find a header in a buffer
Diffstat (limited to 'test-date.c')
-rw-r--r--test-date.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/test-date.c b/test-date.c
index 10afaabbfa..94a6997a8f 100644
--- a/test-date.c
+++ b/test-date.c
@@ -19,19 +19,21 @@ static void show_dates(char **argv, struct timeval *now)
static void parse_dates(char **argv, struct timeval *now)
{
+ struct strbuf result = STRBUF_INIT;
+
for (; *argv; argv++) {
- char result[100];
unsigned long t;
int tz;
- result[0] = 0;
- parse_date(*argv, result, sizeof(result));
- if (sscanf(result, "%lu %d", &t, &tz) == 2)
+ strbuf_reset(&result);
+ parse_date(*argv, &result);
+ if (sscanf(result.buf, "%lu %d", &t, &tz) == 2)
printf("%s -> %s\n",
*argv, show_date(t, tz, DATE_ISO8601));
else
printf("%s -> bad\n", *argv);
}
+ strbuf_release(&result);
}
static void parse_approxidate(char **argv, struct timeval *now)