[Groonga-commit] groonga/groonga [master] Use grn_hash_entry in _grn_hash_key().

Back to archive index

null+****@clear***** null+****@clear*****
2012年 4月 4日 (水) 15:14:49 JST


Susumu Yata	2012-04-04 15:14:49 +0900 (Wed, 04 Apr 2012)

  New Revision: a522e043b366c2be9cdcdc1434f1f85c06769abc

  Log:
    Use grn_hash_entry in _grn_hash_key().

  Modified files:
    lib/hash.c

  Modified: lib/hash.c (+9 -5)
===================================================================
--- lib/hash.c    2012-04-04 15:03:17 +0900 (8500a4c)
+++ lib/hash.c    2012-04-04 15:14:49 +0900 (7fb2259)
@@ -1861,18 +1861,22 @@ grn_hash_get(grn_ctx *ctx, grn_hash *hash, const void *key,
 const char *
 _grn_hash_key(grn_ctx *ctx, grn_hash *hash, grn_id id, uint32_t *key_size)
 {
-  entry_str *ee;
+  grn_hash_entry *entry;
   if (!grn_hash_bitmap_at(ctx, hash, id)) {
     *key_size = 0;
     return NULL;
   }
-  ee = grn_hash_entry_at(ctx, hash, id, 0);
-  if (!ee) {
+  entry = grn_hash_entry_at(ctx, hash, id, 0);
+  if (!entry) {
     *key_size = 0;
     return NULL;
   }
-  *key_size = (hash->obj.header.flags & GRN_OBJ_KEY_VAR_SIZE) ? ee->size : hash->key_size;
-  return get_key(ctx, hash, ee);
+  if (hash->obj.header.flags & GRN_OBJ_KEY_VAR_SIZE) {
+    *key_size = entry->header.key_size;
+  } else {
+    *key_size = hash->key_size;
+  }
+  return grn_hash_entry_get_key(ctx, hash, entry);
 }
 
 int




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