@@ -207,13 +207,13 @@ void show_date_relative(timestamp_t time, struct strbuf *timebuf)
207207 (diff + 183 ) / 365 );
208208}
209209
210- struct date_mode * date_mode_from_type (enum date_mode_type type )
210+ struct date_mode date_mode_from_type (enum date_mode_type type )
211211{
212- static struct date_mode mode = DATE_MODE_INIT ;
212+ struct date_mode mode = DATE_MODE_INIT ;
213213 if (type == DATE_STRFTIME )
214214 BUG ("cannot create anonymous strftime date_mode struct" );
215215 mode .type = type ;
216- return & mode ;
216+ return mode ;
217217}
218218
219219static void show_date_normal (struct strbuf * buf , timestamp_t time , struct tm * tm , int tz , struct tm * human_tm , int human_tz , int local )
@@ -283,21 +283,21 @@ static void show_date_normal(struct strbuf *buf, timestamp_t time, struct tm *tm
283283 strbuf_addf (buf , " %+05d" , tz );
284284}
285285
286- const char * show_date (timestamp_t time , int tz , const struct date_mode * mode )
286+ const char * show_date (timestamp_t time , int tz , struct date_mode mode )
287287{
288288 struct tm * tm ;
289289 struct tm tmbuf = { 0 };
290290 struct tm human_tm = { 0 };
291291 int human_tz = -1 ;
292292 static struct strbuf timebuf = STRBUF_INIT ;
293293
294- if (mode -> type == DATE_UNIX ) {
294+ if (mode . type == DATE_UNIX ) {
295295 strbuf_reset (& timebuf );
296296 strbuf_addf (& timebuf , "%" PRItime , time );
297297 return timebuf .buf ;
298298 }
299299
300- if (mode -> type == DATE_HUMAN ) {
300+ if (mode . type == DATE_HUMAN ) {
301301 struct timeval now ;
302302
303303 get_time (& now );
@@ -306,22 +306,22 @@ const char *show_date(timestamp_t time, int tz, const struct date_mode *mode)
306306 human_tz = local_time_tzoffset (now .tv_sec , & human_tm );
307307 }
308308
309- if (mode -> local )
309+ if (mode . local )
310310 tz = local_tzoffset (time );
311311
312- if (mode -> type == DATE_RAW ) {
312+ if (mode . type == DATE_RAW ) {
313313 strbuf_reset (& timebuf );
314314 strbuf_addf (& timebuf , "%" PRItime " %+05d" , time , tz );
315315 return timebuf .buf ;
316316 }
317317
318- if (mode -> type == DATE_RELATIVE ) {
318+ if (mode . type == DATE_RELATIVE ) {
319319 strbuf_reset (& timebuf );
320320 show_date_relative (time , & timebuf );
321321 return timebuf .buf ;
322322 }
323323
324- if (mode -> local )
324+ if (mode . local )
325325 tm = time_to_tm_local (time , & tmbuf );
326326 else
327327 tm = time_to_tm (time , tz , & tmbuf );
@@ -331,17 +331,17 @@ const char *show_date(timestamp_t time, int tz, const struct date_mode *mode)
331331 }
332332
333333 strbuf_reset (& timebuf );
334- if (mode -> type == DATE_SHORT )
334+ if (mode . type == DATE_SHORT )
335335 strbuf_addf (& timebuf , "%04d-%02d-%02d" , tm -> tm_year + 1900 ,
336336 tm -> tm_mon + 1 , tm -> tm_mday );
337- else if (mode -> type == DATE_ISO8601 )
337+ else if (mode . type == DATE_ISO8601 )
338338 strbuf_addf (& timebuf , "%04d-%02d-%02d %02d:%02d:%02d %+05d" ,
339339 tm -> tm_year + 1900 ,
340340 tm -> tm_mon + 1 ,
341341 tm -> tm_mday ,
342342 tm -> tm_hour , tm -> tm_min , tm -> tm_sec ,
343343 tz );
344- else if (mode -> type == DATE_ISO8601_STRICT ) {
344+ else if (mode . type == DATE_ISO8601_STRICT ) {
345345 strbuf_addf (& timebuf , "%04d-%02d-%02dT%02d:%02d:%02d" ,
346346 tm -> tm_year + 1900 ,
347347 tm -> tm_mon + 1 ,
@@ -354,16 +354,16 @@ const char *show_date(timestamp_t time, int tz, const struct date_mode *mode)
354354 tz = abs (tz );
355355 strbuf_addf (& timebuf , "%02d:%02d" , tz / 100 , tz % 100 );
356356 }
357- } else if (mode -> type == DATE_RFC2822 )
357+ } else if (mode . type == DATE_RFC2822 )
358358 strbuf_addf (& timebuf , "%.3s, %d %.3s %d %02d:%02d:%02d %+05d" ,
359359 weekday_names [tm -> tm_wday ], tm -> tm_mday ,
360360 month_names [tm -> tm_mon ], tm -> tm_year + 1900 ,
361361 tm -> tm_hour , tm -> tm_min , tm -> tm_sec , tz );
362- else if (mode -> type == DATE_STRFTIME )
363- strbuf_addftime (& timebuf , mode -> strftime_fmt , tm , tz ,
364- !mode -> local );
362+ else if (mode . type == DATE_STRFTIME )
363+ strbuf_addftime (& timebuf , mode . strftime_fmt , tm , tz ,
364+ !mode . local );
365365 else
366- show_date_normal (& timebuf , time , tm , tz , & human_tm , human_tz , mode -> local );
366+ show_date_normal (& timebuf , time , tm , tz , & human_tm , human_tz , mode . local );
367367 return timebuf .buf ;
368368}
369369
0 commit comments