From: Willy Tarreau Date: Tue, 4 Sep 2018 17:08:48 +0000 (+0200) Subject: MINOR: tools: make date2str_log() take some consts X-Git-Tag: v1.9-dev2~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f16cb41d19ace1c09f24fac112142f3cc950d73a;p=thirdparty%2Fhaproxy.git MINOR: tools: make date2str_log() take some consts The "tm" and "date" field are not modified, they can be const instead of forcing their callers to use vars. --- diff --git a/include/common/standard.h b/include/common/standard.h index 0a956e069f..7af9c25ceb 100644 --- a/include/common/standard.h +++ b/include/common/standard.h @@ -1072,7 +1072,7 @@ extern const char *monthname[]; * without using sprintf. return a pointer to the last char written (\0) or * NULL if there isn't enough space. */ -char *date2str_log(char *dest, struct tm *tm, struct timeval *date, size_t size); +char *date2str_log(char *dest, const struct tm *tm, const struct timeval *date, size_t size); /* Return the GMT offset for a specific local time. * Both t and tm must represent the same time. diff --git a/src/standard.c b/src/standard.c index 732932ea11..04df94ead2 100644 --- a/src/standard.c +++ b/src/standard.c @@ -2801,7 +2801,7 @@ const char *monthname[12] = { * without using sprintf. return a pointer to the last char written (\0) or * NULL if there isn't enough space. */ -char *date2str_log(char *dst, struct tm *tm, struct timeval *date, size_t size) +char *date2str_log(char *dst, const struct tm *tm, const struct timeval *date, size_t size) { if (size < 25) /* the size is fixed: 24 chars + \0 */