aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-12-05 10:29:45 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-12-05 10:29:45 +0100
commit5f91a400685c0762df5f0f3bbb0b97daaf0d2371 (patch)
tree1cd974ba7bb38129ba201f9cf6c3b8a90af2795c
parent2d6ad13d8daf860595e6d4025861e122ce574871 (diff)
logging: Call color only once and use the result
First we check if a color is defined and then we call it again and use the result. Avoid the second call and use the result of the previous call.
-rw-r--r--src/logging.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/logging.c b/src/logging.c
index 7b532779..36c31c4a 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -245,7 +245,7 @@ static void _output(struct log_target *target, unsigned int subsys,
if (target->use_color) {
const char *c = color(subsys);
if (c) {
- ret = snprintf(buf + offset, rem, "%s", color(subsys));
+ ret = snprintf(buf + offset, rem, "%s", c);
if (ret < 0)
goto err;
OSMO_SNPRINTF_RET(ret, rem, offset, len);