From 916904b88150911ca5d2abed52728f58a0a63d1f Mon Sep 17 00:00:00 2001 From: Vladimir Davydov <vdavydov@tarantool.org> Date: Fri, 21 Oct 2022 16:48:05 +0300 Subject: [PATCH] say: don't check cord for NULL cord() can't be NULL anymore - it's created on demand if not created explicitly with cord_create(). Follow-up #7814 NO_DOC=code cleanup NO_TEST=code cleanup NO_CHANGELOG=code cleanup --- src/lib/core/say.c | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/src/lib/core/say.c b/src/lib/core/say.c index 73552118a9..4f0ee767d9 100644 --- a/src/lib/core/say.c +++ b/src/lib/core/say.c @@ -821,14 +821,10 @@ say_format_plain_tail(char *buf, int len, int level, const char *filename, { int total = 0; - struct cord *cord = cord(); - if (cord) { - SNPRINT(total, snprintf, buf, len, " %s", cord->name); - if (fiber() && fiber()->fid != FIBER_ID_SCHED) { - SNPRINT(total, snprintf, buf, len, "/%llu/%s", - (long long)fiber()->fid, - fiber_name(fiber())); - } + SNPRINT(total, snprintf, buf, len, " %s", cord()->name); + if (fiber() && fiber()->fid != FIBER_ID_SCHED) { + SNPRINT(total, snprintf, buf, len, "/%llu/%s", + (long long)fiber()->fid, fiber_name(fiber())); } if (level == S_WARN || level == S_ERROR || level == S_SYSERROR) { @@ -944,22 +940,15 @@ say_format_json(struct log *log, char *buf, int len, int level, const char *file } SNPRINT(total, snprintf, buf, len, "\"pid\": %i ", getpid()); - - struct cord *cord = cord(); - if (cord) { - SNPRINT(total, snprintf, buf, len, ", \"cord_name\": \""); - SNPRINT(total, json_escape, buf, len, cord->name); + SNPRINT(total, snprintf, buf, len, ", \"cord_name\": \""); + SNPRINT(total, json_escape, buf, len, cord()->name); + SNPRINT(total, snprintf, buf, len, "\""); + if (fiber() && fiber()->fid != FIBER_ID_SCHED) { + SNPRINT(total, snprintf, buf, len, ", \"fiber_id\": %llu, ", + (long long)fiber()->fid); + SNPRINT(total, snprintf, buf, len, "\"fiber_name\": \""); + SNPRINT(total, json_escape, buf, len, fiber()->name); SNPRINT(total, snprintf, buf, len, "\""); - if (fiber() && fiber()->fid != FIBER_ID_SCHED) { - SNPRINT(total, snprintf, buf, len, - ", \"fiber_id\": %llu, ", - (long long)fiber()->fid); - SNPRINT(total, snprintf, buf, len, - "\"fiber_name\": \""); - SNPRINT(total, json_escape, buf, len, - fiber()->name); - SNPRINT(total, snprintf, buf, len, "\""); - } } if (filename) { -- GitLab