From 1803a86edc1605d5cca3e4e2e39a4659607b1aef Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Wed, 24 Apr 2024 16:00:57 +0200 Subject: [PATCH] Minor, drop another useless prlen=0 and reindent block Signed-off-by: Joachim Wiberg --- src/syslog.c | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/src/syslog.c b/src/syslog.c index 489d891..8f83cff 100644 --- a/src/syslog.c +++ b/src/syslog.c @@ -329,30 +329,27 @@ vsyslogp_r(int pri, struct syslog_data *data, const char *msgid, if (!(data->log_stat & LOG_NLOG)) { prlen = snprintf(p, tbuf_left, "<%d>1 ", pri); DEC(); - } else - prlen = 0; + } - { - prlen = strftime(p, tbuf_left, "%FT%T", &tmnow); - DEC(); - prlen = snprintf(p, tbuf_left, ".%06ld", (long)tv.tv_usec); - DEC(); - prlen = strftime(p, tbuf_left-1, "%z", &tmnow); - /* strftime gives eg. "+0200", but we need "+02:00" */ - if (prlen == 5) { - p[prlen+1] = p[prlen]; - p[prlen] = p[prlen-1]; - p[prlen-1] = p[prlen-2]; - p[prlen-2] = ':'; - prlen += 1; - } + prlen = strftime(p, tbuf_left, "%FT%T", &tmnow); + DEC(); + prlen = snprintf(p, tbuf_left, ".%06ld", (long)tv.tv_usec); + DEC(); + prlen = strftime(p, tbuf_left-1, "%z", &tmnow); + /* strftime gives eg. "+0200", but we need "+02:00" */ + if (prlen == 5) { + p[prlen+1] = p[prlen]; + p[prlen] = p[prlen-1]; + p[prlen-1] = p[prlen-2]; + p[prlen-2] = ':'; + prlen += 1; + } - if (data->log_stat & (LOG_PERROR|LOG_CONS|LOG_NLOG)) { - strftime(dbuf, sizeof(dbuf), "%b %d %Y %T ", &tmnow); - iov[iovcnt].iov_base = dbuf; - iov[iovcnt].iov_len = strlen(dbuf); - iovcnt++; - } + if (data->log_stat & (LOG_PERROR|LOG_CONS|LOG_NLOG)) { + strftime(dbuf, sizeof(dbuf), "%b %d %Y %T ", &tmnow); + iov[iovcnt].iov_base = dbuf; + iov[iovcnt].iov_len = strlen(dbuf); + iovcnt++; } if (data == &sdata)