Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: kostja@tarantool.org
Subject: [tarantool-patches] [PATCH v2 4/4] Extract 'coll' library from 'core'
Date: Tue, 26 Feb 2019 15:11:36 +0300	[thread overview]
Message-ID: <dae1fec2632ba4f5cf18a547f0e756ed942ea49e.1551182934.git.v.shpilevoy@tarantool.org> (raw)
In-Reply-To: <cover.1551182934.git.v.shpilevoy@tarantool.org>
In-Reply-To: <cover.1551182934.git.v.shpilevoy@tarantool.org>

Core is supposed to be the most basic library, providing only
really common features used everywhere like fiber, diag, memory,
logging. Which can't be said about collations - they are used
only by high level things - SQL, Lua utf8, comparators.

Collations are built now as 'lib/coll' library.

The patch is not necessary for anything, but it is a right thing
to do, while some activity is happening there.
---
 src/CMakeLists.txt                | 2 +-
 src/box/coll_id.c                 | 2 +-
 src/box/coll_id_def.h             | 2 +-
 src/box/sql/expr.c                | 2 +-
 src/box/sql/fk_constraint.c       | 2 +-
 src/box/sql/func.c                | 2 +-
 src/box/sql/select.c              | 2 +-
 src/box/sql/vdbeaux.c             | 2 +-
 src/box/sql/where.c               | 2 +-
 src/box/sql/whereexpr.c           | 2 +-
 src/box/tuple_compare.cc          | 2 +-
 src/box/tuple_hash.cc             | 2 +-
 src/lib/CMakeLists.txt            | 1 +
 src/lib/coll/CMakeLists.txt       | 2 ++
 src/lib/{core => coll}/coll.c     | 0
 src/lib/{core => coll}/coll.h     | 0
 src/lib/{core => coll}/coll_def.c | 0
 src/lib/{core => coll}/coll_def.h | 0
 src/lib/core/CMakeLists.txt       | 2 --
 src/lua/utf8.c                    | 2 +-
 src/main.cc                       | 2 +-
 test/unit/CMakeLists.txt          | 2 +-
 test/unit/coll.cpp                | 4 ++--
 23 files changed, 20 insertions(+), 19 deletions(-)
 create mode 100644 src/lib/coll/CMakeLists.txt
 rename src/lib/{core => coll}/coll.c (100%)
 rename src/lib/{core => coll}/coll.h (100%)
 rename src/lib/{core => coll}/coll_def.c (100%)
 rename src/lib/{core => coll}/coll_def.h (100%)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b115e14c9..481618f20 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -162,7 +162,7 @@ endif()
 
 set_source_files_compile_flags(${server_sources})
 add_library(server STATIC ${server_sources})
-target_link_libraries(server core http_parser bit uri uuid ${ICU_LIBRARIES})
+target_link_libraries(server core coll http_parser bit uri uuid)
 
 # Rule of thumb: if exporting a symbol from a static library, list the
 # library here.
diff --git a/src/box/coll_id.c b/src/box/coll_id.c
index b56c74961..5abeaed21 100644
--- a/src/box/coll_id.c
+++ b/src/box/coll_id.c
@@ -30,7 +30,7 @@
  */
 #include "coll_id.h"
 #include "coll_id_def.h"
-#include "coll.h"
+#include "coll/coll.h"
 #include "error.h"
 #include "diag.h"
 
diff --git a/src/box/coll_id_def.h b/src/box/coll_id_def.h
index 489280c00..859209274 100644
--- a/src/box/coll_id_def.h
+++ b/src/box/coll_id_def.h
@@ -33,7 +33,7 @@
 
 #include <stddef.h>
 #include <stdint.h>
-#include <coll_def.h>
+#include "coll/coll_def.h"
 #include "opt_def.h"
 
 /** Collation identifier definition. */
diff --git a/src/box/sql/expr.c b/src/box/sql/expr.c
index c914cfb68..a75f23756 100644
--- a/src/box/sql/expr.c
+++ b/src/box/sql/expr.c
@@ -34,7 +34,7 @@
  * for generating VDBE code that evaluates expressions in sql.
  */
 #include "box/coll_id_cache.h"
-#include "coll.h"
+#include "coll/coll.h"
 #include "sqlInt.h"
 #include "tarantoolInt.h"
 #include "box/schema.h"
diff --git a/src/box/sql/fk_constraint.c b/src/box/sql/fk_constraint.c
index 93c01a0e7..4066b1cf1 100644
--- a/src/box/sql/fk_constraint.c
+++ b/src/box/sql/fk_constraint.c
@@ -33,7 +33,7 @@
  * This file contains code used by the compiler to add foreign key
  * support to compiled SQL statements.
  */
-#include "coll.h"
+#include "coll/coll.h"
 #include "sqlInt.h"
 #include "box/fk_constraint.h"
 #include "box/schema.h"
diff --git a/src/box/sql/func.c b/src/box/sql/func.c
index 79e2c0e18..775fc7cc1 100644
--- a/src/box/sql/func.c
+++ b/src/box/sql/func.c
@@ -37,7 +37,7 @@
 #include "sqlInt.h"
 #include "vdbeInt.h"
 #include "version.h"
-#include "coll.h"
+#include "coll/coll.h"
 #include <unicode/ustring.h>
 #include <unicode/ucasemap.h>
 #include <unicode/ucnv.h>
diff --git a/src/box/sql/select.c b/src/box/sql/select.c
index 6a465a616..7c55f2e0b 100644
--- a/src/box/sql/select.c
+++ b/src/box/sql/select.c
@@ -33,7 +33,7 @@
  * This file contains C code routines that are called by the parser
  * to handle SELECT statements in sql.
  */
-#include "coll.h"
+#include "coll/coll.h"
 #include "sqlInt.h"
 #include "tarantoolInt.h"
 #include "vdbeInt.h"
diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c
index e0f66ea1b..bb64dbdf7 100644
--- a/src/box/sql/vdbeaux.c
+++ b/src/box/sql/vdbeaux.c
@@ -34,7 +34,7 @@
  * a VDBE (or an "sql_stmt" as it is known to the outside world.)
  */
 #include "fiber.h"
-#include "coll.h"
+#include "coll/coll.h"
 #include "box/session.h"
 #include "box/schema.h"
 #include "box/tuple_format.h"
diff --git a/src/box/sql/where.c b/src/box/sql/where.c
index 1bba9d65c..f494ead4c 100644
--- a/src/box/sql/where.c
+++ b/src/box/sql/where.c
@@ -37,7 +37,7 @@
  * so is applicable.  Because this module is responsible for selecting
  * indices, you might also think of this module as the "query optimizer".
  */
-#include "coll.h"
+#include "coll/coll.h"
 #include "sqlInt.h"
 #include "tarantoolInt.h"
 #include "vdbeInt.h"
diff --git a/src/box/sql/whereexpr.c b/src/box/sql/whereexpr.c
index fa906e305..6df28ad8a 100644
--- a/src/box/sql/whereexpr.c
+++ b/src/box/sql/whereexpr.c
@@ -38,7 +38,7 @@
  * analyzing Expr objects in the WHERE clause.
  */
 #include "box/coll_id_cache.h"
-#include "coll.h"
+#include "coll/coll.h"
 #include "sqlInt.h"
 #include "whereInt.h"
 
diff --git a/src/box/tuple_compare.cc b/src/box/tuple_compare.cc
index cbdd150b8..cf4519ccb 100644
--- a/src/box/tuple_compare.cc
+++ b/src/box/tuple_compare.cc
@@ -30,7 +30,7 @@
  */
 #include "tuple_compare.h"
 #include "tuple.h"
-#include "coll.h"
+#include "coll/coll.h"
 #include "trivia/util.h" /* NOINLINE */
 #include <math.h>
 
diff --git a/src/box/tuple_hash.cc b/src/box/tuple_hash.cc
index 0aed4c14c..9ee435503 100644
--- a/src/box/tuple_hash.cc
+++ b/src/box/tuple_hash.cc
@@ -32,7 +32,7 @@
 #include "tuple_hash.h"
 #include "tuple.h"
 #include "third_party/PMurHash.h"
-#include "coll.h"
+#include "coll/coll.h"
 #include <math.h>
 
 /* Tuple and key hasher */
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index 9e90c75ab..39795bbae 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -9,6 +9,7 @@ add_subdirectory(uri)
 add_subdirectory(http_parser)
 add_subdirectory(core)
 add_subdirectory(uuid)
+add_subdirectory(coll)
 if(ENABLE_BUNDLED_MSGPUCK)
     add_subdirectory(msgpuck EXCLUDE_FROM_ALL)
 endif()
diff --git a/src/lib/coll/CMakeLists.txt b/src/lib/coll/CMakeLists.txt
new file mode 100644
index 000000000..c01e608bb
--- /dev/null
+++ b/src/lib/coll/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(coll STATIC coll.c coll_def.c)
+target_link_libraries(coll core ${ICU_LIBRARIES})
diff --git a/src/lib/core/coll.c b/src/lib/coll/coll.c
similarity index 100%
rename from src/lib/core/coll.c
rename to src/lib/coll/coll.c
diff --git a/src/lib/core/coll.h b/src/lib/coll/coll.h
similarity index 100%
rename from src/lib/core/coll.h
rename to src/lib/coll/coll.h
diff --git a/src/lib/core/coll_def.c b/src/lib/coll/coll_def.c
similarity index 100%
rename from src/lib/core/coll_def.c
rename to src/lib/coll/coll_def.c
diff --git a/src/lib/core/coll_def.h b/src/lib/coll/coll_def.h
similarity index 100%
rename from src/lib/core/coll_def.h
rename to src/lib/coll/coll_def.h
diff --git a/src/lib/core/CMakeLists.txt b/src/lib/core/CMakeLists.txt
index 6238f3cee..eb10b11c3 100644
--- a/src/lib/core/CMakeLists.txt
+++ b/src/lib/core/CMakeLists.txt
@@ -24,8 +24,6 @@ set(core_sources
     util.c
     random.c
     trigger.cc
-    coll.c
-    coll_def.c
     mpstream.c
     port.c
 )
diff --git a/src/lua/utf8.c b/src/lua/utf8.c
index 6d3e4d39a..a009a4655 100644
--- a/src/lua/utf8.c
+++ b/src/lua/utf8.c
@@ -30,7 +30,7 @@
  */
 #include <unicode/ucasemap.h>
 #include <unicode/uchar.h>
-#include <coll.h>
+#include "coll/coll.h"
 #include "lua/utils.h"
 #include "lua/utf8.h"
 #include "diag.h"
diff --git a/src/main.cc b/src/main.cc
index df7468907..39d5fb351 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -58,7 +58,7 @@
 #include <say.h>
 #include <rmean.h>
 #include <limits.h>
-#include "coll.h"
+#include "coll/coll.h"
 #include "trivia/util.h"
 #include "backtrace.h"
 #include "tt_pthread.h"
diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
index 18118d374..04bc659e7 100644
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -193,7 +193,7 @@ add_executable(vy_cache.test vy_cache.c ${ITERATOR_TEST_SOURCES})
 target_link_libraries(vy_cache.test ${ITERATOR_TEST_LIBS})
 
 add_executable(coll.test coll.cpp)
-target_link_libraries(coll.test core unit ${ICU_LIBRARIES} misc)
+target_link_libraries(coll.test coll unit misc)
 
 add_executable(tuple_bigref.test tuple_bigref.c)
 target_link_libraries(tuple_bigref.test tuple unit)
diff --git a/test/unit/coll.cpp b/test/unit/coll.cpp
index 94374a7b0..5a7f49195 100644
--- a/test/unit/coll.cpp
+++ b/test/unit/coll.cpp
@@ -7,8 +7,8 @@
 #include <diag.h>
 #include <fiber.h>
 #include <memory.h>
-#include "coll_def.h"
-#include "coll.h"
+#include "coll/coll_def.h"
+#include "coll/coll.h"
 #include "unit.h"
 #include "third_party/PMurHash.h"
 
-- 
2.17.2 (Apple Git-113)

  parent reply	other threads:[~2019-02-26 12:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-26 12:11 [tarantool-patches] [PATCH v2 0/4] Move 'core' lib to src/lib Vladislav Shpilevoy
2019-02-26 12:11 ` [tarantool-patches] [PATCH v2 1/4] Remove dead dependency of http_parser on httpc Vladislav Shpilevoy
2019-02-26 12:12   ` [tarantool-patches] " Vladislav Shpilevoy
2019-02-26 12:21   ` Konstantin Osipov
2019-02-26 12:11 ` [tarantool-patches] [PATCH v2 2/4] Move 'http_parser' to src/lib Vladislav Shpilevoy
2019-02-26 12:21   ` [tarantool-patches] " Konstantin Osipov
2019-02-26 16:57     ` Vladislav Shpilevoy
2019-02-26 12:11 ` [tarantool-patches] [PATCH v2 3/4] Move 'core' and 'uuid' libs " Vladislav Shpilevoy
2019-02-26 12:22   ` [tarantool-patches] " Konstantin Osipov
2019-02-26 16:57     ` Vladislav Shpilevoy
2019-02-26 12:11 ` Vladislav Shpilevoy [this message]
2019-02-26 12:23   ` [tarantool-patches] Re: [PATCH v2 4/4] Extract 'coll' library from 'core' Konstantin Osipov
2019-02-26 12:37     ` Vladislav Shpilevoy
2019-02-26 12:55       ` Konstantin Osipov
2019-02-26 13:09         ` Vladislav Shpilevoy
2019-02-26 13:17           ` Konstantin Osipov
2019-02-26 13:43             ` Vladislav Shpilevoy
2019-02-27 15:07               ` Vladislav Shpilevoy
2019-02-26 16:55 ` [tarantool-patches] [PATCH 1/1] Move 'info' library to src/lib Vladislav Shpilevoy
2019-02-26 22:08   ` [tarantool-patches] " Konstantin Osipov
2019-02-27 15:07     ` Vladislav Shpilevoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dae1fec2632ba4f5cf18a547f0e756ed942ea49e.1551182934.git.v.shpilevoy@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH v2 4/4] Extract '\''coll'\'' library from '\''core'\''' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox