[Groonga-commit] groonga/groonga [master] Change grn_hash_get_key_value() to return 0 if value is N/A.

アーカイブの一覧に戻る

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


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

  New Revision: b61cbf39c1eb8653ef700ee23436effb63252a7c

  Log:
    Change grn_hash_get_key_value() to return 0 if value is N/A.

  Modified files:
    lib/hash.c

  Modified: lib/hash.c (+5 -4)
===================================================================
--- lib/hash.c    2012-04-04 15:42:58 +0900 (6a43429)
+++ lib/hash.c    2012-04-04 15:43:48 +0900 (2682920)
@@ -1994,11 +1994,12 @@ grn_hash_get_key_value(grn_ctx *ctx, grn_hash *hash, grn_id id,
   if (bufsize >= key_size) {
     memcpy(keybuf, grn_hash_entry_get_key(ctx, hash, entry), key_size);
   }
+  value = grn_hash_entry_get_value(hash, entry);
+  if (!value) {
+    return 0;
+  }
   if (valuebuf) {
-    value = grn_hash_entry_get_value(hash, entry);
-    if (value) {
-      memcpy(valuebuf, value, hash->value_size);
-    }
+    memcpy(valuebuf, value, hash->value_size);
   }
   return key_size;
 }




Groonga-commit メーリングリストの案内
アーカイブの一覧に戻る