diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2013-10-27 18:31:25 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2013-10-27 18:31:25 +0000 |
commit | ce610d8a76997841f3ea191357ab19c1dbcdd968 (patch) | |
tree | fcb9fb3c77999231a53e9792f85d67897480cdf3 /usr.bin/rcs | |
parent | 40466794e1c3294ef2645bd741f4244f169b3cb4 (diff) |
If a constant string needs a name, use a static const array instead of a
pointer or non-const array, as that minimizes the symbols, maximizes the
placement into read-only memory, and avoids warnings from gcc -Wformat=2
when they're used as format strings.
ok deraadt@
Diffstat (limited to 'usr.bin/rcs')
-rw-r--r-- | usr.bin/rcs/ci.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.bin/rcs/ci.c b/usr.bin/rcs/ci.c index 9c5aa511d76..f8142d31d4e 100644 --- a/usr.bin/rcs/ci.c +++ b/usr.bin/rcs/ci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ci.c,v 1.215 2013/04/17 00:20:52 deraadt Exp $ */ +/* $OpenBSD: ci.c,v 1.216 2013/10/27 18:31:24 guenther Exp $ */ /* * Copyright (c) 2005, 2006 Niall O'Higgins <niallo@openbsd.org> * All rights reserved. @@ -472,11 +472,10 @@ checkin_update(struct checkin_params *pb) if (pb->date != DATE_NOW) { time_t head_date = rcs_rev_getdate(pb->file, pb->frev); if (pb->date <= head_date) { - char dbuf1[256], dbuf2[256], *fmt; + static const char fmt[] = "%Y/%m/%d %H:%M:%S"; + char dbuf1[256], dbuf2[256]; struct tm *t, *t_head; - fmt = "%Y/%m/%d %H:%M:%S"; - t = gmtime(&pb->date); strftime(dbuf1, sizeof(dbuf1), fmt, t); t_head = gmtime(&head_date); |