This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Neels Hofmeyr gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/5816 cosmetic: logging: if color is disabled, don't print "" If color output is disabled, skip the empty snprintf() to (not) clear the ANSI color. Also, no need to use a format string of "%s", just pass the string constant directly. That is a micro optimisation as well as clarification of the code. Change-Id: Ie7cb06de160830d2f8ee5718246c0fe311f68d49 --- M src/logging.c 1 file changed, 6 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/16/5816/1 diff --git a/src/logging.c b/src/logging.c index 1ce8878..fce259f 100644 --- a/src/logging.c +++ b/src/logging.c @@ -419,11 +419,12 @@ goto err; OSMO_SNPRINTF_RET(ret, rem, offset, len); - ret = snprintf(buf + offset, rem, "%s", - target->use_color ? "\033[0;m" : ""); - if (ret < 0) - goto err; - OSMO_SNPRINTF_RET(ret, rem, offset, len); + if (target->use_color) { + ret = snprintf(buf + offset, rem, "\033[0;m"); + if (ret < 0) + goto err; + OSMO_SNPRINTF_RET(ret, rem, offset, len); + } err: buf[sizeof(buf)-1] = '\0'; target->output(target, level, buf); -- To view, visit https://gerrit.osmocom.org/5816 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie7cb06de160830d2f8ee5718246c0fe311f68d49 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>