OSDN Git Service

am 813a3a2d: Merge "If dalvik wants ASCII casing, it needs to ask for it."
[android-x86/dalvik.git] / vm / Hash.h
index 2c6bd5e..38f710f 100644 (file)
--- a/vm/Hash.h
+++ b/vm/Hash.h
  * When the number of elements reaches a certain percentage of the table's
  * capacity, the table will be resized.
  */
-#ifndef _DALVIK_HASH
-#define _DALVIK_HASH
-
-#ifdef __cplusplus
-extern "C" {
-#endif
+#ifndef DALVIK_HASH_H_
+#define DALVIK_HASH_H_
 
 /* compute the hash of an item with a specific type */
 typedef u4 (*HashCompute)(const void* item);
@@ -62,10 +58,10 @@ typedef int (*HashForeachRemoveFunc)(void* data);
  *
  * When an entry is released, we will call (HashFreeFunc)(entry->data).
  */
-typedef struct HashEntry {
+struct HashEntry {
     u4 hashValue;
     void* data;
-} HashEntry;
+};
 
 #define HASH_TOMBSTONE ((void*) 0xcbcacccd)     // invalid ptr value
 
@@ -74,14 +70,14 @@ typedef struct HashEntry {
  *
  * This structure should be considered opaque.
  */
-typedef struct HashTable {
+struct HashTable {
     int         tableSize;          /* must be power of 2 */
     int         numEntries;         /* current #of "live" entries */
     int         numDeadEntries;     /* current #of tombstone entries */
     HashEntry*  pEntries;           /* array on heap */
     HashFreeFunc freeFunc;
     pthread_mutex_t lock;
-} HashTable;
+};
 
 /*
  * Create and initialize a HashTable structure, using "initialSize" as
@@ -183,11 +179,11 @@ int dvmHashForeachRemove(HashTable* pHashTable, HashForeachRemoveFunc func);
  *       MyData* data = (MyData*)dvmHashIterData(&iter);
  *   }
  */
-typedef struct HashIter {
+struct HashIter {
     void*       data;
     HashTable*  pHashTable;
     int         idx;
-} HashIter;
+};
 INLINE void dvmHashIterNext(HashIter* pIter) {
     int i = pIter->idx +1;
     int lim = pIter->pHashTable->tableSize;
@@ -222,8 +218,4 @@ typedef u4 (*HashCalcFunc)(const void* item);
 void dvmHashTableProbeCount(HashTable* pHashTable, HashCalcFunc calcFunc,
     HashCompareFunc cmpFunc);
 
-#ifdef __cplusplus
-}
-#endif
-
-#endif /*_DALVIK_HASH*/
+#endif  // DALVIK_HASH_H_