[Groonga-commit] groonga/groonga [master] added GRN_COLUMN_EACH()

Back to archive index

null+****@clear***** null+****@clear*****
2011年 12月 22日 (木) 07:41:37 JST


Daijiro MORI	2011-12-21 22:41:37 +0000 (Wed, 21 Dec 2011)

  New Revision: 9a373e1b2521924c82a086eb0942df971057f1eb

  Log:
    added GRN_COLUMN_EACH()

  Modified files:
    include/groonga.h

  Modified: include/groonga.h (+10 -0)
===================================================================
--- include/groonga.h    2011-12-21 15:39:34 +0000 (af5ed49)
+++ include/groonga.h    2011-12-21 22:41:37 +0000 (3f3ecf4)
@@ -1431,6 +1431,16 @@ GRN_API grn_obj *grn_obj_get_value(grn_ctx *ctx, grn_obj *obj, grn_id id, grn_ob
  **/
 GRN_API int grn_obj_get_values(grn_ctx *ctx, grn_obj *obj, grn_id offset, void **values);
 
+#define GRN_COLUMN_EACH(ctx,column,id,value,block) do {\
+  int _n;\
+  grn_id id = 1;\
+  while ((_n = grn_obj_get_values(ctx, column, id, (void **)&value)) > 0) {\
+    for (; _n; _n--, id++, value++) {\
+      block\
+    }\
+  }\
+} while (0)
+
 /**
  * grn_obj_set_value:
  * @obj: 対象object




Groonga-commit メーリングリストの案内
Back to archive index