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

Back to archive index

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


Susumu Yata	2012-04-04 15:31:48 +0900 (Wed, 04 Apr 2012)

  New Revision: 3ab3e8f06158ec86fff41bf2655844ecd187313b

  Log:
    Use grn_hash_entry in grn_hash_get_value_().

  Modified files:
    lib/hash.c

  Modified: lib/hash.c (+14 -7)
===================================================================
--- lib/hash.c    2012-04-04 15:29:32 +0900 (e613407)
+++ lib/hash.c    2012-04-04 15:31:48 +0900 (7d10d22)
@@ -1955,14 +1955,21 @@ grn_hash_get_value(grn_ctx *ctx, grn_hash *hash, grn_id id, void *valuebuf)
 const char *
 grn_hash_get_value_(grn_ctx *ctx, grn_hash *hash, grn_id id, uint32_t *size)
 {
-  entry_str *ee;
-  const char *value = NULL;
-  if (!grn_hash_bitmap_at(ctx, hash, id)) { return NULL; }
-  ee = grn_hash_entry_at(ctx, hash, id, 0);
-  if (ee && (value = get_value(hash, ee))) {
-    *size = hash->value_size;
+  const void *value;
+  grn_hash_entry *entry;
+  if (!grn_hash_bitmap_at(ctx, hash, id)) {
+    return NULL;
+  }
+  entry = grn_hash_entry_at(ctx, hash, id, 0);
+  if (!entry) {
+    return NULL;
+  }
+  value = grn_hash_entry_get_value(hash, entry);
+  if (!value) {
+    return NULL;
   }
-  return value;
+  *size = hash->value_size;
+  return (const char *)value;
 }
 
 int




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