commit 10fa70e266dcd8539efd48ef30628e48068cb5b4 from: Omar Polo via: Thomas Adam date: Sun Oct 08 11:13:51 2023 UTC gotwebd: inline the only use of TM_RFC822 commit - cbe7b7d7141fcd8437b7ea83d5c1f4f84b9e6981 commit + 10fa70e266dcd8539efd48ef30628e48068cb5b4 blob - 17ccc57c2c33ce3bdbf92fe4b70615c83efa04e6 blob + 17655d809061e6c714a1d7b150302233dafe4f5e --- gotwebd/gotweb.c +++ gotwebd/gotweb.c @@ -1412,19 +1412,7 @@ gotweb_render_age(struct template *tp, time_t committe if (tp_writes(tp, datebuf) == -1 || tp_writes(tp, " UTC") == -1) - return -1; - break; - case TM_RFC822: - if (gmtime_r(&committer_time, &tm) == NULL) - return -1; - - r = strftime(datebuf, sizeof(datebuf), - "%a, %d %b %Y %H:%M:%S GMT", &tm); - if (r == 0) return -1; - - if (tp_writes(tp, datebuf) == -1) - return -1; break; } return 0; blob - 8e18e98aad26908b7294403e5baed1ce637e1368 blob + 973ce5ba19977634ab3437a3557bdff3a8f03439 --- gotwebd/gotwebd.h +++ gotwebd/gotwebd.h @@ -440,7 +440,6 @@ enum query_actions { enum gotweb_ref_tm { TM_DIFF, TM_LONG, - TM_RFC822, }; extern struct gotwebd *gotwebd_env; blob - 15e76f92a8e1e904a1d67de07ba474e2d0161c0c blob + 7c8ae023b9acffb8f74ebb838e31638043b1e25b --- gotwebd/pages.tmpl +++ gotwebd/pages.tmpl @@ -989,6 +989,9 @@ static inline int rss_author(struct template *, char * struct request *c = tp->tp_arg; struct transport *t = c->t; struct repo_dir *repo_dir = t->repo_dir; + struct tm tm; + char rfc822[128]; + int r; char *tag_name = rt->tag_name; struct gotweb_url tag = { .action = TAG, @@ -1000,6 +1003,12 @@ static inline int rss_author(struct template *, char * if (strncmp(tag_name, "refs/tags/", 10) == 0) tag_name += 10; + + if (gmtime_r(&rt->tagger_time, &tm) == NULL) + return -1; + r = strftime(rfc822, sizeof(rfc822), "%a, %d %b %Y %H:%M:%S GMT", &tm); + if (r == 0) + return 0; !} {{ repo_dir->name }} {{" "}} {{ tag_name }} @@ -1014,7 +1023,7 @@ static inline int rss_author(struct template *, char * {{ render rss_author(tp, rt->tagger) }} {{ rt->commit_id }} - {{ render gotweb_render_age(tp, rt->tagger_time, TM_RFC822) }} + {{ rfc822 }} {{ end }}