Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--date.c3
-rw-r--r--date.h4
-rw-r--r--ref-filter.c2
-rw-r--r--t/helper/test-date.c2
4 files changed, 7 insertions, 4 deletions
diff --git a/date.c b/date.c
index 863b07e9e6..54c709e4a0 100644
--- a/date.c
+++ b/date.c
@@ -206,11 +206,10 @@ void show_date_relative(timestamp_t time, struct strbuf *timebuf)
struct date_mode *date_mode_from_type(enum date_mode_type type)
{
- static struct date_mode mode;
+ static struct date_mode mode = DATE_MODE_INIT;
if (type == DATE_STRFTIME)
BUG("cannot create anonymous strftime date_mode struct");
mode.type = type;
- mode.local = 0;
return &mode;
}
diff --git a/date.h b/date.h
index 5db9ec8dd2..c3a00d08ed 100644
--- a/date.h
+++ b/date.h
@@ -20,6 +20,10 @@ struct date_mode {
int local;
};
+#define DATE_MODE_INIT { \
+ .type = DATE_NORMAL, \
+}
+
/*
* Convenience helper for passing a constant type, like:
*
diff --git a/ref-filter.c b/ref-filter.c
index f7a2f17bfd..3399bde932 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -1251,7 +1251,7 @@ static void grab_date(const char *buf, struct atom_value *v, const char *atomnam
char *zone;
timestamp_t timestamp;
long tz;
- struct date_mode date_mode = { DATE_NORMAL };
+ struct date_mode date_mode = DATE_MODE_INIT;
const char *formatp;
/*
diff --git a/t/helper/test-date.c b/t/helper/test-date.c
index ded3d059f5..111071e1dd 100644
--- a/t/helper/test-date.c
+++ b/t/helper/test-date.c
@@ -35,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++) {