From 24f997205bea4c88cee3d8fc84bbae1f47f78ed0 Mon Sep 17 00:00:00 2001
From: Konstantin Osipov <kostja@tarantool.org>
Date: Mon, 16 Dec 2013 21:48:05 +0400
Subject: [PATCH] Fix a compile error.

---
 src/CMakeLists.txt         |  4 +---
 src/assoc.h                |  2 +-
 src/box/box_lua.cc         |  2 +-
 src/box/box_lua_space.cc   |  2 +-
 src/box/hash_index.cc      |  2 +-
 src/box/key_def.h          |  2 +-
 src/box/space.h            |  2 +-
 src/box/tuple_convert.cc   |  6 ------
 src/box/tuple_update.cc    |  2 +-
 src/coeio.cc               |  1 -
 src/coeio.h                |  1 -
 src/fiber.cc               |  1 -
 src/fiber.h                |  2 +-
 src/ipc.cc                 |  2 +-
 src/lib/CMakeLists.txt     |  1 +
 src/lib/small/region.h     |  2 +-
 src/lib/small/slab_cache.h |  2 +-
 src/lua/init.cc            |  2 +-
 src/lua/init.h             |  4 ++--
 src/mutex.h                |  2 +-
 src/plugin.h               |  2 +-
 src/trigger.h              |  2 +-
 test/unit/CMakeLists.txt   | 10 +++++-----
 test/unit/mhash.c          |  4 ++--
 test/unit/rlist.c          |  2 +-
 test/unit/rope.c           |  2 +-
 test/unit/rope_avl.c       |  2 +-
 test/unit/rope_basic.c     |  2 +-
 test/unit/rope_stress.c    |  2 +-
 29 files changed, 31 insertions(+), 41 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a98372c626..a4c2a91e77 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -70,10 +70,8 @@ set (common_sources
      fio.c
      plugin.c
      crc32.c
-     rope.c
      tbuf.c
      opts.c
-     rlist.c
      cpu_feature.c
      lua/fiber.cc
      lua/trigger.cc
@@ -102,7 +100,7 @@ set_source_files_compile_flags(${common_sources})
 add_library(core STATIC ${common_sources})
 add_dependencies(core generate_headers)
 
-set (common_libraries cfg core small)
+set (common_libraries cfg core small salad)
 
 list(APPEND common_libraries
     ${LIBEV_LIBRARIES}
diff --git a/src/assoc.h b/src/assoc.h
index 17577eb2a8..35b8e75387 100644
--- a/src/assoc.h
+++ b/src/assoc.h
@@ -51,7 +51,7 @@ struct mh_i32ptr_node_t {
 #define mh_hash_key(a, arg) (a)
 #define mh_eq(a, b, arg) ((a->key) == (b->key))
 #define mh_eq_key(a, b, arg) ((a) == (b->key))
-#include <mhash.h>
+#include "salad/mhash.h"
 
 #if defined(__cplusplus)
 } /* extern "C" */
diff --git a/src/box/box_lua.cc b/src/box/box_lua.cc
index f6323c82af..1062c1ba1a 100644
--- a/src/box/box_lua.cc
+++ b/src/box/box_lua.cc
@@ -1711,7 +1711,7 @@ schema_lua_init(struct lua_State *L)
 }
 
 void
-mod_lua_init(struct lua_State *L)
+box_lua_init(struct lua_State *L)
 {
 	/* box, box.tuple */
 	luaL_register_type(L, tuplelib_name, lbox_tuple_meta);
diff --git a/src/box/box_lua_space.cc b/src/box/box_lua_space.cc
index 20dbec5fd0..138e079d24 100644
--- a/src/box/box_lua_space.cc
+++ b/src/box/box_lua_space.cc
@@ -39,7 +39,7 @@ extern "C" {
 #include "space.h"
 #include "schema.h"
 #include <trigger.h>
-#include <rlist.h>
+#include "salad/rlist.h"
 #include <scoped_guard.h>
 #include "box_lua.h"
 #include "txn.h"
diff --git a/src/box/hash_index.cc b/src/box/hash_index.cc
index 14682f1c1c..35ea70f5a1 100644
--- a/src/box/hash_index.cc
+++ b/src/box/hash_index.cc
@@ -121,7 +121,7 @@ mh_index_hash_key(const char *key, const struct key_def *key_def)
 typedef struct tuple * mh_node_t;
 #define mh_name _index
 #define MH_SOURCE 1
-#include <mhash.h>
+#include "salad/mhash.h"
 
 /* {{{ HashIndex Iterators ****************************************/
 
diff --git a/src/box/key_def.h b/src/box/key_def.h
index 54d5ff3abc..b29aef5440 100644
--- a/src/box/key_def.h
+++ b/src/box/key_def.h
@@ -29,7 +29,7 @@
  * SUCH DAMAGE.
  */
 #include "trivia/util.h"
-#include "rlist.h"
+#include "salad/rlist.h"
 #include <exception.h>
 #include "msgpuck/msgpuck.h"
 
diff --git a/src/box/space.h b/src/box/space.h
index 8408a4770f..6f57c0f345 100644
--- a/src/box/space.h
+++ b/src/box/space.h
@@ -30,7 +30,7 @@
  */
 #include "index.h"
 #include "key_def.h"
-#include "rlist.h"
+#include "salad/rlist.h"
 #include <exception.h>
 
 typedef void (*space_f)(struct space *space);
diff --git a/src/box/tuple_convert.cc b/src/box/tuple_convert.cc
index 41fb74f2a3..083940938e 100644
--- a/src/box/tuple_convert.cc
+++ b/src/box/tuple_convert.cc
@@ -30,12 +30,6 @@
 #include "iobuf.h"
 #include "tbuf.h"
 
-extern "C" {
-#include <lua.h>
-#include <lauxlib.h>
-#include <lualib.h>
-} /* extern "C" */
-
 void
 tuple_to_obuf(struct tuple *tuple, struct obuf *buf)
 {
diff --git a/src/box/tuple_update.cc b/src/box/tuple_update.cc
index 446a8a776e..d49c399043 100644
--- a/src/box/tuple_update.cc
+++ b/src/box/tuple_update.cc
@@ -31,7 +31,7 @@
 
 #include "third_party/queue.h"
 
-#include <rope.h>
+#include "salad/rope.h"
 #include <exception.h>
 #include <pickle.h>
 #include "msgpuck/msgpuck.h"
diff --git a/src/coeio.cc b/src/coeio.cc
index 9421502bbc..96fd0cd00b 100644
--- a/src/coeio.cc
+++ b/src/coeio.cc
@@ -29,7 +29,6 @@
 #include "coeio.h"
 #include "fiber.h"
 #include "exception.h"
-#include <rlist.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/src/coeio.h b/src/coeio.h
index 4fea38d46c..5f52c51595 100644
--- a/src/coeio.h
+++ b/src/coeio.h
@@ -39,7 +39,6 @@
 #include <tarantool_ev.h>
 #include <tarantool_eio.h>
 #include <coro.h>
-#include <rlist.h>
 
 #include <sys/types.h>
 #include <sys/socket.h>
diff --git a/src/fiber.cc b/src/fiber.cc
index 6982668673..305385d524 100644
--- a/src/fiber.cc
+++ b/src/fiber.cc
@@ -35,7 +35,6 @@
 #include "say.h"
 #include "stat.h"
 #include "assoc.h"
-#include "rlist.h"
 #include "memory.h"
 
 enum { FIBER_CALL_STACK = 16 };
diff --git a/src/fiber.h b/src/fiber.h
index 1de34ed54c..6a1d497e57 100644
--- a/src/fiber.h
+++ b/src/fiber.h
@@ -42,7 +42,7 @@
 #if defined(__cplusplus)
 #include "exception.h"
 #endif /* defined(__cplusplus) */
-#include "rlist.h"
+#include "salad/rlist.h"
 
 #define FIBER_NAME_MAX REGION_NAME_MAX
 #define FIBER_READING_INBOX (1 << 0)
diff --git a/src/ipc.cc b/src/ipc.cc
index c70454bb65..28e958f942 100644
--- a/src/ipc.cc
+++ b/src/ipc.cc
@@ -29,7 +29,7 @@
 #include "ipc.h"
 #include "fiber.h"
 #include <stdlib.h>
-#include <rlist.h>
+#include "salad/rlist.h"
 
 struct ipc_channel {
 	struct rlist readers, writers, bcast;
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index 1cdd97dc0f..c59a1cc460 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_subdirectory(bit)
 add_subdirectory(bitset)
 add_subdirectory(small)
+add_subdirectory(salad)
 add_library(msgpuck STATIC msgpuck/msgpuck.c)
diff --git a/src/lib/small/region.h b/src/lib/small/region.h
index 07f80d4f5f..b974742327 100644
--- a/src/lib/small/region.h
+++ b/src/lib/small/region.h
@@ -32,7 +32,7 @@
 #include <inttypes.h>
 #include <assert.h>
 #include <stdio.h>
-#include "rlist.h"
+#include "salad/rlist.h"
 #include "slab_cache.h"
 
 #ifdef __cplusplus
diff --git a/src/lib/small/slab_cache.h b/src/lib/small/slab_cache.h
index 8ad797c2ef..86131231b7 100644
--- a/src/lib/small/slab_cache.h
+++ b/src/lib/small/slab_cache.h
@@ -32,7 +32,7 @@
 #include <limits.h>
 #include <stddef.h>
 #include <assert.h>
-#include "rlist.h"
+#include "salad/rlist.h"
 #include "slab_arena.h"
 
 #if defined(__cplusplus)
diff --git a/src/lua/init.cc b/src/lua/init.cc
index 7c2e6e326c..b9f4785bff 100644
--- a/src/lua/init.cc
+++ b/src/lua/init.cc
@@ -340,7 +340,7 @@ tarantool_lua_init()
 			      *s, lua_tostring(L, -1));
 	}
 
-	mod_lua_init(L);
+	box_lua_init(L);
 
 	/* init after internal luas are processed */
 	tarantool_plugin_init(L);
diff --git a/src/lua/init.h b/src/lua/init.h
index e5a67216f3..6db00dacbc 100644
--- a/src/lua/init.h
+++ b/src/lua/init.h
@@ -43,12 +43,12 @@ struct tbuf;
  * No return value, panics if error.
  */
 extern void
-mod_lua_init(struct lua_State *L);
+box_lua_init(struct lua_State *L);
 
 /**
  * Create an instance of Lua interpreter and load it with
  * Tarantool modules.  Creates a Lua state, imports global
- * Tarantool modules, then calls mod_lua_init(), which performs
+ * Tarantool modules, then calls box_lua_init(), which performs
  * module-specific imports. The created state can be freed as any
  * other, with lua_close().
  *
diff --git a/src/mutex.h b/src/mutex.h
index 29e656255a..df3b1b1eb7 100644
--- a/src/mutex.h
+++ b/src/mutex.h
@@ -31,7 +31,7 @@
 
 #include <assert.h>
 #include "fiber.h"
-#include "rlist.h"
+#include "salad/rlist.h"
 
 /** Mutex of cooperative multitasking environment. */
 
diff --git a/src/plugin.h b/src/plugin.h
index 03c0d6f03a..1365c67619 100644
--- a/src/plugin.h
+++ b/src/plugin.h
@@ -36,7 +36,7 @@ extern "C" {
 #define PLUGIN_API_VERSION		1
 
 #include <stddef.h>
-#include "rlist.h"
+#include "salad/rlist.h"
 
 struct lua_State;
 struct tbuf;
diff --git a/src/trigger.h b/src/trigger.h
index d3ebeb17e8..9bf3439cbd 100644
--- a/src/trigger.h
+++ b/src/trigger.h
@@ -28,7 +28,7 @@
  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-#include "rlist.h"
+#include "salad/rlist.h"
 /**
  * Type of the callback which may be invoked
  * on an event.
diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt
index 2afb883c72..f41e42ba7f 100644
--- a/test/unit/CMakeLists.txt
+++ b/test/unit/CMakeLists.txt
@@ -4,13 +4,13 @@ set_source_files_compile_flags(${all_sources})
 include_directories(${PROJECT_SOURCE_DIR}/src)
 include_directories(${PROJECT_BINARY_DIR}/src)
 include_directories(${PROJECT_SOURCE_DIR}/src/lib)
-add_executable(rlist.test rlist.c test.c ${CMAKE_SOURCE_DIR}/src/rlist.c)
+add_executable(rlist.test rlist.c test.c ${CMAKE_SOURCE_DIR}/src/lib/salad/rlist.c)
 add_executable(queue.test queue.c)
 add_executable(mhash.test mhash.c)
-add_executable(rope_basic.test rope_basic.c ${CMAKE_SOURCE_DIR}/src/rope.c)
-add_executable(rope_avl.test rope_avl.c ${CMAKE_SOURCE_DIR}/src/rope.c)
-add_executable(rope_stress.test rope_stress.c ${CMAKE_SOURCE_DIR}/src/rope.c)
-add_executable(rope.test rope.c ${CMAKE_SOURCE_DIR}/src/rope.c)
+add_executable(rope_basic.test rope_basic.c ${CMAKE_SOURCE_DIR}/src/lib/salad/rope.c)
+add_executable(rope_avl.test rope_avl.c ${CMAKE_SOURCE_DIR}/src/lib/salad/rope.c)
+add_executable(rope_stress.test rope_stress.c ${CMAKE_SOURCE_DIR}/src/lib/salad/rope.c)
+add_executable(rope.test rope.c ${CMAKE_SOURCE_DIR}/src/lib/salad/rope.c)
 add_executable(bit.test bit.c bit.c)
 target_link_libraries(bit.test bit)
 add_executable(bitset_basic.test bitset_basic.c)
diff --git a/test/unit/mhash.c b/test/unit/mhash.c
index 2cf9ff7c84..b3393d31f6 100644
--- a/test/unit/mhash.c
+++ b/test/unit/mhash.c
@@ -13,7 +13,7 @@ struct mh_i32_node_t {
 #define mh_arg_t void *
 #define mh_hash(a, arg) (a->key)
 #define mh_eq(a, b, arg) ((a->key) == (b->key))
-#include "mhash.h"
+#include "salad/mhash.h"
 
 #define mh_name _i32_collision
 struct mh_i32_collision_node_t {
@@ -25,7 +25,7 @@ struct mh_i32_collision_node_t {
 #define mh_hash(a, arg) 42
 #define mh_eq(a, b, arg) ((a->key) == (b->key))
 
-#include "mhash.h"
+#include "salad/mhash.h"
 
 #undef MH_SOURCE
 
diff --git a/test/unit/rlist.c b/test/unit/rlist.c
index e530a99238..fb0ed37eab 100644
--- a/test/unit/rlist.c
+++ b/test/unit/rlist.c
@@ -1,4 +1,4 @@
-#include <rlist.h>
+#include "salad/rlist.h"
 #include <stdio.h>
 #include <stdarg.h>
 #include "test.h"
diff --git a/test/unit/rope.c b/test/unit/rope.c
index b1119f2efc..029aedc863 100644
--- a/test/unit/rope.c
+++ b/test/unit/rope.c
@@ -1,4 +1,4 @@
-#include <rope.h>
+#include "salad/rope.h"
 #include "unit.h"
 #include "rope_common.h"
 
diff --git a/test/unit/rope_avl.c b/test/unit/rope_avl.c
index c3b51599ca..9e978f46c0 100644
--- a/test/unit/rope_avl.c
+++ b/test/unit/rope_avl.c
@@ -1,4 +1,4 @@
-#include <rope.h>
+#include "salad/rope.h"
 #include "unit.h"
 #include "rope_common.h"
 
diff --git a/test/unit/rope_basic.c b/test/unit/rope_basic.c
index 34aaa1c4f3..b4a0e78760 100644
--- a/test/unit/rope_basic.c
+++ b/test/unit/rope_basic.c
@@ -1,4 +1,4 @@
-#include <rope.h>
+#include "salad/rope.h"
 #include "unit.h"
 #include "rope_common.h"
 
diff --git a/test/unit/rope_stress.c b/test/unit/rope_stress.c
index be617b9d96..35c43a7a7c 100644
--- a/test/unit/rope_stress.c
+++ b/test/unit/rope_stress.c
@@ -1,4 +1,4 @@
-#include <rope.h>
+#include "salad/rope.h"
 #include <time.h>
 #include "unit.h"
 #include "rope_common.h"
-- 
GitLab