From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id CDAC8441854 for ; Fri, 20 Mar 2020 11:20:22 +0300 (MSK) Received: by mail-lf1-f66.google.com with SMTP id y2so3774871lfe.11 for ; Fri, 20 Mar 2020 01:20:22 -0700 (PDT) From: Cyrill Gorcunov Date: Fri, 20 Mar 2020 11:19:47 +0300 Message-Id: <20200320081956.30650-3-gorcunov@gmail.com> In-Reply-To: <20200320081956.30650-1-gorcunov@gmail.com> References: <20200320081956.30650-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v15 02/11] box: recovery_journal -- declare it as static List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tml There is no need for several instances of recovery journal variable. Lets make it statically allocated inside recovery_journal_create routine. And drop the inline annotation because there is absolutely no need for this routine being inline. Suggested-by: Konstantin Osipov Signed-off-by: Cyrill Gorcunov --- src/box/box.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/box/box.cc b/src/box/box.cc index eb5931e37..cf79affca 100644 --- a/src/box/box.cc +++ b/src/box/box.cc @@ -326,12 +326,14 @@ recovery_journal_write(struct journal *base, return 0; } -static inline void -recovery_journal_create(struct recovery_journal *journal, struct vclock *v) +static void +recovery_journal_create(struct vclock *v) { - journal_create(&journal->base, recovery_journal_write, NULL); - journal->vclock = v; - journal_set(&journal->base); + static struct recovery_journal journal; + + journal_create(&journal.base, recovery_journal_write, NULL); + journal.vclock = v; + journal_set(&journal.base); } static void @@ -2054,8 +2056,7 @@ bootstrap_from_master(struct replica *master) * Process final data (WALs). */ engine_begin_final_recovery_xc(); - struct recovery_journal journal; - recovery_journal_create(&journal, &replicaset.vclock); + recovery_journal_create(&replicaset.vclock); if (!replication_anon) { applier_resume_to_state(applier, APPLIER_JOINED, @@ -2219,8 +2220,7 @@ local_recovery(const struct tt_uuid *instance_uuid, memtx = (struct memtx_engine *)engine_by_name("memtx"); assert(memtx != NULL); - struct recovery_journal journal; - recovery_journal_create(&journal, &recovery->vclock); + recovery_journal_create(&recovery->vclock); /* * We explicitly request memtx to recover its -- 2.20.1