aboutsummaryrefslogtreecommitdiffstats
path: root/common/gettime.c
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2016-10-06 12:48:52 +0000
committerJustus Winter <[email protected]>2016-10-06 12:48:52 +0000
commit4aadc751f201f8f97c9c1f454e3a29803cce3edb (patch)
tree5d212ba9acd087e8d751b4b683e628d69b5e4388 /common/gettime.c
parentg10: Fix singular term. (diff)
downloadgnupg-4aadc751f201f8f97c9c1f454e3a29803cce3edb.tar.gz
gnupg-4aadc751f201f8f97c9c1f454e3a29803cce3edb.zip
common: Avoid pointer arithmetic on string literals.
* common/gettime.c (rfctimestamp): Use indexing instead. * common/signal.c (got_fatal_signal): Likewise.
Diffstat (limited to 'common/gettime.c')
-rw-r--r--common/gettime.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/common/gettime.c b/common/gettime.c
index 9702bbcac..9c6365886 100644
--- a/common/gettime.c
+++ b/common/gettime.c
@@ -740,10 +740,10 @@ rfctimestamp (u32 stamp)
if (!tp)
return NULL;
return xtryasprintf ("%.3s, %02d %.3s %04d %02d:%02d:%02d +0000",
- ("SunMonTueWedThuFriSat" + (tp->tm_wday%7)*3),
+ &"SunMonTueWedThuFriSat"[(tp->tm_wday%7)*3],
tp->tm_mday,
- ("JanFebMarAprMayJunJulAugSepOctNovDec"
- + (tp->tm_mon%12)*3),
+ &"JanFebMarAprMayJunJulAugSepOctNovDec"
+ [(tp->tm_mon%12)*3],
tp->tm_year + 1900,
tp->tm_hour,
tp->tm_min,