From 0f07b184c8eae23d72f3aeec94fa927c2db0b1c0 Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Wed, 1 Mar 2017 02:25:20 +0100 Subject: [PATCH] util: return pointer to string literal directly in sprinttime There is no sense to copy it to static buffer first. * util.c (sprinttime): Just return "0", do not copy it to internal buffer first. --- util.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/util.c b/util.c index 9144efb6..31336a42 100644 --- a/util.c +++ b/util.c @@ -550,10 +550,8 @@ sprinttime(time_t t) struct tm *tmp; static char buf[sizeof(int) * 3 * 6 + sizeof("+0000")]; - if (t == 0) { - strcpy(buf, "0"); - return buf; - } + if (t == 0) + return "0"; tmp = localtime(&t); if (tmp) strftime(buf, sizeof(buf), "%FT%T%z", tmp); -- 2.50.1