[Groonga-commit] pgroonga/pgroonga at 6b9d3f6 [master] Split global buffer related code

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Jan 23 23:22:53 JST 2016


Kouhei Sutou	2016-01-23 23:22:53 +0900 (Sat, 23 Jan 2016)

  New Revision: 6b9d3f63f4e2a0dba8f88d9cfd54ee40ea9a0a5a
  https://github.com/pgroonga/pgroonga/commit/6b9d3f63f4e2a0dba8f88d9cfd54ee40ea9a0a5a

  Message:
    Split global buffer related code

  Added files:
    src/pgrn_global.c
  Modified files:
    CMakeLists.txt
    Makefile
    src/pgrn_global.h
    src/pgroonga.c

  Modified: CMakeLists.txt (+1 -0)
===================================================================
--- CMakeLists.txt    2016-01-23 23:15:37 +0900 (a8a1763)
+++ CMakeLists.txt    2016-01-23 23:22:53 +0900 (1847e32)
@@ -48,6 +48,7 @@ link_directories(
 
 set(PGRN_SOURCES
   "src/pgroonga.c"
+  "src/pgrn_global.c"
   "src/pgrn_inspect.c"
   "src/pgrn_options.c"
   "src/pgrn_value.c"

  Modified: Makefile (+1 -0)
===================================================================
--- Makefile    2016-01-23 23:15:37 +0900 (6513136)
+++ Makefile    2016-01-23 23:22:53 +0900 (33fdea0)
@@ -4,6 +4,7 @@ GROONGA_PKG = "groonga >= $(REQUIRED_GROONGA_VERSION)"
 MODULE_big = pgroonga
 SRCS =						\
 	src/pgroonga.c				\
+	src/pgrn_global.c			\
 	src/pgrn_inspect.c			\
 	src/pgrn_options.c			\
 	src/pgrn_value.c			\

  Added: src/pgrn_global.c (+19 -0) 100644
===================================================================
--- /dev/null
+++ src/pgrn_global.c    2016-01-23 23:22:53 +0900 (403f77a)
@@ -0,0 +1,19 @@
+#include "pgrn_global.h"
+
+grn_ctx PGrnContext;
+struct PGrnBuffers PGrnBuffers;
+
+static grn_ctx *ctx = &PGrnContext;
+
+void
+PGrnInitializeBuffers(void)
+{
+	GRN_TEXT_INIT(&(PGrnBuffers.inspect), 0);
+}
+
+void
+PGrnFinalizeBuffers(void)
+{
+	GRN_OBJ_FIN(ctx, &(PGrnBuffers.inspect));
+}
+

  Modified: src/pgrn_global.h (+3 -0)
===================================================================
--- src/pgrn_global.h    2016-01-23 23:15:37 +0900 (9747722)
+++ src/pgrn_global.h    2016-01-23 23:22:53 +0900 (8b05766)
@@ -8,3 +8,6 @@ struct PGrnBuffers {
 
 grn_ctx PGrnContext;
 struct PGrnBuffers PGrnBuffers;
+
+void PGrnInitializeBuffers(void);
+void PGrnFinalizeBuffers(void);

  Modified: src/pgroonga.c (+3 -5)
===================================================================
--- src/pgroonga.c    2016-01-23 23:15:37 +0900 (4a40766)
+++ src/pgroonga.c    2016-01-23 23:22:53 +0900 (2de89dc)
@@ -179,9 +179,6 @@ PG_FUNCTION_INFO_V1(pgroonga_vacuumcleanup);
 PG_FUNCTION_INFO_V1(pgroonga_canreturn);
 PG_FUNCTION_INFO_V1(pgroonga_costestimate);
 
-grn_ctx PGrnContext;
-struct PGrnBuffers PGrnBuffers;
-
 static grn_ctx *ctx = NULL;
 static grn_obj buffer;
 static grn_obj pathBuffer;
@@ -273,7 +270,7 @@ PGrnOnProcExit(int code, Datum arg)
 
 		PGrnFinalizeSequentialSearchData();
 
-		GRN_OBJ_FIN(ctx, &(PGrnBuffers.inspect));
+		PGrnFinalizeBuffers();
 		GRN_OBJ_FIN(ctx, &footBuffer);
 		GRN_OBJ_FIN(ctx, &bodyBuffer);
 		GRN_OBJ_FIN(ctx, &headBuffer);
@@ -362,7 +359,8 @@ _PG_init(void)
 	GRN_TEXT_INIT(&headBuffer, 0);
 	GRN_TEXT_INIT(&bodyBuffer, 0);
 	GRN_TEXT_INIT(&footBuffer, 0);
-	GRN_TEXT_INIT(&(PGrnBuffers.inspect), 0);
+
+	PGrnInitializeBuffers();
 
 	PGrnEnsureDatabase();
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index