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

Back to archive index

null+****@clear***** null+****@clear*****
2012年 4月 4日 (水) 10:38:54 JST


Susumu Yata	2012-04-04 10:38:54 +0900 (Wed, 04 Apr 2012)

  New Revision: c62b7b32f63b906fe899083e3b1152135d99b40e

  Log:
    Use grn_hash_entry in grn_io_hash_calculate_entry_size().

  Modified files:
    lib/hash.c

  Modified: lib/hash.c (+4 -5)
===================================================================
--- lib/hash.c    2012-04-04 09:53:41 +0900 (da6afb0)
+++ lib/hash.c    2012-04-04 10:38:54 +0900 (117aee4)
@@ -1279,17 +1279,16 @@ static uint32_t
 grn_io_hash_calculate_entry_size(uint32_t key_size, uint32_t value_size,
                                  uint32_t flags)
 {
-  uint32_t entry_size;
   if (flags & GRN_OBJ_KEY_VAR_SIZE) {
-    entry_size = (intptr_t)(&((entry_str *)0)->dummy) + value_size;
+    return (uintptr_t)((grn_io_hash_entry *)0)->value + value_size;
   } else {
     if (key_size == sizeof(uint32_t)) {
-      entry_size = (intptr_t)(&((entry *)0)->dummy) + value_size;
+      return (uintptr_t)((grn_plain_hash_entry *)0)->value + value_size;
     } else {
-      entry_size = (intptr_t)(&((entry *)0)->dummy) + key_size + value_size;
+      return (uintptr_t)((grn_rich_hash_entry *)0)->key_and_value
+          + key_size + value_size;
     }
   }
-  return entry_size;
 }
 
 static grn_io *




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