[Groonga-commit] pgroonga/pgroonga at 88b1d13 [master] Extract PGrnIndexColumnSetSource()

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Jan 24 20:54:20 JST 2016


Kouhei Sutou	2016-01-24 20:54:20 +0900 (Sun, 24 Jan 2016)

  New Revision: 88b1d13464c39b12961bc5b2ce835d3d6bab1a5d
  https://github.com/pgroonga/pgroonga/commit/88b1d13464c39b12961bc5b2ce835d3d6bab1a5d

  Message:
    Extract PGrnIndexColumnSetSource()

  Modified files:
    src/pgrn_groonga.c
    src/pgrn_groonga.h
    src/pgroonga.c

  Modified: src/pgrn_groonga.c (+16 -0)
===================================================================
--- src/pgrn_groonga.c    2016-01-24 12:09:44 +0900 (54f530b)
+++ src/pgrn_groonga.c    2016-01-24 20:54:20 +0900 (82074f6)
@@ -166,3 +166,19 @@ PGrnCreateColumn(grn_obj	*table,
 
 	return column;
 }
+
+void
+PGrnIndexColumnSetSource(grn_obj *indexColumn, grn_obj *source)
+{
+	grn_obj sourceIDs;
+	grn_id sourceID;
+
+	GRN_RECORD_INIT(&sourceIDs, GRN_OBJ_VECTOR, GRN_ID_NIL);
+
+	sourceID = grn_obj_id(ctx, source);
+	GRN_RECORD_PUT(ctx, &sourceIDs, sourceID);
+
+	grn_obj_set_info(ctx, indexColumn, GRN_INFO_SOURCE, &sourceIDs);
+
+	GRN_OBJ_FIN(ctx, &sourceIDs);
+}

  Modified: src/pgrn_groonga.h (+2 -0)
===================================================================
--- src/pgrn_groonga.h    2016-01-24 12:09:44 +0900 (d8f3bb0)
+++ src/pgrn_groonga.h    2016-01-24 20:54:20 +0900 (1f37c34)
@@ -29,3 +29,5 @@ grn_obj *PGrnCreateColumn(grn_obj *table,
 						  const char*name,
 						  grn_obj_flags flags,
 						  grn_obj *type);
+
+void PGrnIndexColumnSetSource(grn_obj *indexColumn, grn_obj *source);

  Modified: src/pgroonga.c (+1 -16)
===================================================================
--- src/pgroonga.c    2016-01-24 12:09:44 +0900 (9f5e315)
+++ src/pgroonga.c    2016-01-24 20:54:20 +0900 (196a3fc)
@@ -1031,21 +1031,6 @@ PGrnCreate(Relation index,
 	}
 }
 
-static void
-PGrnSetSource(grn_obj *indexColumn,
-			  grn_obj *source,
-			  grn_obj *sourceIDs)
-{
-	grn_id sourceID;
-
-	GRN_BULK_REWIND(sourceIDs);
-
-	sourceID = grn_obj_id(ctx, source);
-	GRN_RECORD_PUT(ctx, sourceIDs, sourceID);
-
-	grn_obj_set_info(ctx, indexColumn, GRN_INFO_SOURCE, sourceIDs);
-}
-
 #ifdef JSONBOID
 static void
 PGrnSetSourceForJSON(Relation index,
@@ -1164,7 +1149,7 @@ PGrnSetSources(Relation index, grn_obj *sourcesTable)
 		}
 
 		source = PGrnLookupColumn(sourcesTable, name->data, ERROR);
-		PGrnSetSource(indexColumn, source, &sourceIDs);
+		PGrnIndexColumnSetSource(indexColumn, source);
 		grn_obj_unlink(ctx, source);
 		grn_obj_unlink(ctx, indexColumn);
 	}
-------------- next part --------------
HTML����������������������������...
Download 



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