date API: provide and use a DATE_MODE_INIT

Provide and use a DATE_MODE_INIT macro. Most of the users of struct
date_mode" use it via pretty.h's "struct pretty_print_context" which
doesn't have an initialization macro, so we're still bound to being
initialized to "{ 0 }" by default.

But we can change the couple of callers that directly declared a
variable on the stack to instead use the initializer, and thus do away
with the "mode.local = 0" added in add00ba2de (date: make "local"
orthogonal to date format, 2015-09-03).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason
2022-02-16 09:14:03 +01:00
committed by Junio C Hamano
parent 88c7b4c3c8
commit f184289832
4 changed files with 7 additions and 4 deletions

4
date.h
View File

@ -20,6 +20,10 @@ struct date_mode {
int local;
};
#define DATE_MODE_INIT { \
.type = DATE_NORMAL, \
}
/*
* Convenience helper for passing a constant type, like:
*