[Groonga-commit] groonga/groonga at dd41e77 [master] Use GRN_HASH_EACH_BEGIN/END

Back to archive index

Kouhei Sutou null+****@clear*****
Thu May 26 09:38:07 JST 2016


Kouhei Sutou	2016-05-26 09:38:07 +0900 (Thu, 26 May 2016)

  New Revision: dd41e77857da361fed23c7446a537f4cb84031d8
  https://github.com/groonga/groonga/commit/dd41e77857da361fed23c7446a537f4cb84031d8

  Message:
    Use GRN_HASH_EACH_BEGIN/END

  Modified files:
    lib/db.c

  Modified: lib/db.c (+10 -4)
===================================================================
--- lib/db.c    2016-05-26 09:24:23 +0900 (6d078c1)
+++ lib/db.c    2016-05-26 09:38:07 +0900 (67b5ea2)
@@ -3204,18 +3204,24 @@ grn_accessor_resolve_one_table(grn_ctx *ctx, grn_accessor *accessor,
   }
 
   {
-    grn_id *record_id;
     grn_posting posting;
-    grn_rset_recinfo *recinfo;
 
     memset(&posting, 0, sizeof(posting));
-    GRN_HASH_EACH(ctx, (grn_hash *)current_res, id, &record_id, NULL, &recinfo, {
+    GRN_HASH_EACH_BEGIN(ctx, (grn_hash *)current_res, cursor, id) {
+      void *key;
+      void *value;
+      grn_id *record_id;
+      grn_rset_recinfo *recinfo;
       grn_id next_record_id;
 
+      grn_hash_cursor_get_key_value(ctx, cursor, &key, NULL, &value);
+      record_id = key;
+      recinfo = value;
       next_record_id = grn_table_get(ctx,
                                      table,
                                      record_id,
                                      sizeof(grn_id));
+
       posting.rid = next_record_id;
       posting.weight = recinfo->score;
       rc = grn_ii_posting_add(ctx,
@@ -3225,7 +3231,7 @@ grn_accessor_resolve_one_table(grn_ctx *ctx, grn_accessor *accessor,
       if (rc != GRN_SUCCESS) {
         break;
       }
-    });
+    } GRN_HASH_EACH_END(ctx, cursor);
   }
 
   if (rc != GRN_SUCCESS) {
-------------- next part --------------
HTML����������������������������...
Download 



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