[PATCH] ui-shared: don't keep unused copy of cgit_date_mode() in .data

наб nabijaczleweli at nabijaczleweli.xyz
Tue Jul 29 19:33:54 UTC 2025


Also, const on the return type is meaningless

Fixes: dbadd85 ("git: update to v2.45.0")
---
 ui-shared.c | 4 ++--
 ui-shared.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ui-shared.c b/ui-shared.c
index 6fae72d..4ea1b40 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -664,9 +664,9 @@ void cgit_submodule_link(const char *class, char *path, const char *rev)
 		path[len - 1] = tail;
 }
 
-const struct date_mode cgit_date_mode(enum date_mode_type type)
+struct date_mode cgit_date_mode(enum date_mode_type type)
 {
-	static struct date_mode mode;
+	struct date_mode mode = {};
 	mode.type = type;
 	mode.local = ctx.cfg.local_time;
 	return mode;
diff --git a/ui-shared.h b/ui-shared.h
index f12fa99..8eb961e 100644
--- a/ui-shared.h
+++ b/ui-shared.h
@@ -65,7 +65,7 @@ __attribute__((format (printf,1,2)))
 extern void cgit_print_error(const char *fmt, ...);
 __attribute__((format (printf,1,0)))
 extern void cgit_vprint_error(const char *fmt, va_list ap);
-extern const struct date_mode cgit_date_mode(enum date_mode_type type);
+extern struct date_mode cgit_date_mode(enum date_mode_type type);
 extern void cgit_print_age(time_t t, int tz, time_t max_relative);
 extern void cgit_print_http_headers(void);
 extern void cgit_redirect(const char *url, bool permanent);
-- 
2.39.5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/cgit/attachments/20250729/d2da72f9/attachment.sig>


More information about the CGit mailing list