summaryrefslogtreecommitdiff
path: root/t/helper/test-date.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2022-02-25 15:47:36 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2022-02-25 15:47:36 -0800
commit0a01df08c03fe707e22795de7bd1d763ed02e9e1 (patch)
treeb9ff98081b5cacb5106d303d21378cc5aeb99278 /t/helper/test-date.c
parentMerge branch 'jc/name-rev-stdin' (diff)
parentdate API: add and use a date_mode_release() (diff)
downloadtgif-0a01df08c03fe707e22795de7bd1d763ed02e9e1.tar.xz
Merge branch 'ab/date-mode-release'
Plug (some) memory leaks around parse_date_format(). * ab/date-mode-release: date API: add and use a date_mode_release() date API: add basic API docs date API: provide and use a DATE_MODE_INIT date API: create a date.h, split from cache.h cache.h: remove always unused show_date_human() declaration
Diffstat (limited to 't/helper/test-date.c')
-rw-r--r--t/helper/test-date.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/t/helper/test-date.c b/t/helper/test-date.c
index 099eff4f0f..45951b1df8 100644
--- a/t/helper/test-date.c
+++ b/t/helper/test-date.c
@@ -1,5 +1,6 @@
#include "test-tool.h"
#include "cache.h"
+#include "date.h"
static const char *usage_msg = "\n"
" test-tool date relative [time_t]...\n"
@@ -34,7 +35,7 @@ static void show_human_dates(const char **argv)
static void show_dates(const char **argv, const char *format)
{
- struct date_mode mode;
+ struct date_mode mode = DATE_MODE_INIT;
parse_date_format(format, &mode);
for (; *argv; argv++) {
@@ -53,6 +54,8 @@ static void show_dates(const char **argv, const char *format)
printf("%s -> %s\n", *argv, show_date(t, tz, &mode));
}
+
+ date_mode_release(&mode);
}
static void parse_dates(const char **argv)