From 441a327051f5357175029709030a0ee51131379d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Sat, 24 Apr 2021 08:05:37 +0700 Subject: compat: rename {,notmuch_}canonicalize_file_name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When compat canonicalize_file_name was introduced, it was limited to C code only because it was used by C code only during that time. >From 5ec6fd4d, (lib/open: check for split configuration when creating database., 2021-02-16), lib/open.cc, which is C++, relies on the existent of canonicalize_file_name. However, we can't blindly enable canonicalize_file_name for C++ code, because different implementation has different additional signature for C++ and users can arbitrarily add -DHAVE_CANONICALIZE_FILE_NAME=0 to {C,CXX}FLAGS. Let's move our implementation into a util library. Helped-by: Tomi Ollila Signed-off-by: Đoàn Trần Công Danh --- lib/open.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/open.cc b/lib/open.cc index 5d80a884..bdb695fe 100644 --- a/lib/open.cc +++ b/lib/open.cc @@ -3,6 +3,7 @@ #include "database-private.h" #include "parse-time-vrp.h" +#include "path-util.h" #if HAVE_XAPIAN_DB_RETRY_LOCK #define DB_ACTION (Xapian::DB_CREATE_OR_OPEN | Xapian::DB_RETRY_LOCK) @@ -612,9 +613,9 @@ notmuch_database_create_with_config (const char *database_path, _set_database_path (notmuch, database_path); if (key_file && ! split) { - char *mail_root = canonicalize_file_name ( + char *mail_root = notmuch_canonicalize_file_name ( g_key_file_get_value (key_file, "database", "mail_root", NULL)); - char *db_path = canonicalize_file_name (database_path); + char *db_path = notmuch_canonicalize_file_name (database_path); split = (mail_root && (0 != strcmp (mail_root, db_path))); -- cgit v1.2.3