online.git: common/Util.cpp common/Util.hpp Makefile.am

0 views
Skip to first unread message

"Areg Nakashian (via cogerrit)"

unread,
5:20 AM (1 hour ago) 5:20 AM
to collaboraon...@googlegroups.com
Makefile.am | 1 +
common/Util.cpp | 1 -
common/Util.hpp | 9 ++++++++-
3 files changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 11a338ae5589f7cdeeb077b56d46757ff77b7dac
Author: Areg Nakashian <areg.na...@gmail.com>
AuthorDate: Sun Apr 26 13:36:30 2026 -0400
Commit: Ashod Nakashian <ashod.n...@collabora.co.uk>
CommitDate: Wed Apr 29 09:20:35 2026 +0000

common: wsd: make isKitInProcess constexpr

The setKitInProcess function was only called with the true argument
in coolwsd-inproc.cpp, which is only compiled when ENABLE_DEBUG is true.
Similarly, setKitInProcess was always called with false argument from
coolwsd-fork.cpp.

Since these are compile time invariants, create ENABLE_INPROC compiler
directive when ENABLE_DEBUG is true in Makefile.am, and convert isKitInProcess
into a constexpr function that returns true if ENABLE_INPROC, and simplify its
implementation.

Signed-off-by: Areg Nakashian <areg.na...@gmail.com>
Change-Id: Ic1744cad1c3d06bacba4298daa9132ac5bb9c892
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/1693
Reviewed-by: Ashod Nakashian <ashod.n...@collabora.co.uk>
Tested-by: Jenkins CPCI <rel...@collaboraoffice.com>

diff --git a/Makefile.am b/Makefile.am
index ac04b7da44c9..4f6cf3e1e8eb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -331,6 +331,7 @@ coolwsd_inproc_SOURCES = $(coolwsd_sources) \
$(coolforkit_sources) \
wsd/coolwsd-inproc.cpp

+coolwsd_inproc_CPPFLAGS = $(AM_CPPFLAGS) -DENABLE_INPROC=1
coolwsd_inproc_LDADD = libsimd.a libkitwsdglobals.a

if !ENABLE_SSL
diff --git a/common/Util.cpp b/common/Util.cpp
index 884483bbda11..87612f66793d 100644
--- a/common/Util.cpp
+++ b/common/Util.cpp
@@ -187,7 +187,6 @@ namespace Util

bool kitInProcess = false;
void setKitInProcess(bool value) { kitInProcess = value; }
- bool isKitInProcess() { return isFuzzing() || isMobileApp() || kitInProcess; }

std::string replace(std::string result, const std::string_view from, const std::string_view to)
{
diff --git a/common/Util.hpp b/common/Util.hpp
index 19fa21d0128d..8bc6777ed2f2 100644
--- a/common/Util.hpp
+++ b/common/Util.hpp
@@ -1109,7 +1109,14 @@ int main(int argc, char**argv)
}

void setKitInProcess(bool value);
- bool isKitInProcess();
+ constexpr bool isKitInProcess()
+ {
+#if defined(ENABLE_INPROC) && ENABLE_INPROC
+ return true;
+#else
+ return isFuzzing() || isMobileApp();
+#endif // ENABLE_INPROC
+ }

/**
* Splits string into vector<string>. Does not accept referenced variables for easy

Reply all
Reply to author
Forward
0 new messages