--- gcc/objc/hash.h 2018/04/24 18:03:32 1.1 +++ gcc/objc/hash.h 2018/04/24 18:20:20 1.1.1.4 @@ -1,5 +1,5 @@ /* Hash tables for Objective C method dispatch. - Copyright (C) 1992 Free Software Foundation, Inc. + Copyright (C) 1993 Free Software Foundation, Inc. This file is part of GNU CC. @@ -27,8 +27,7 @@ the Free Software Foundation, 675 Mass A #ifndef __hash_INCLUDE_GNU #define __hash_INCLUDE_GNU -#include "mutex.h" - +#include /* * This data structure is used to hold items @@ -145,7 +144,7 @@ void *hash_value_for_key (cache_ptr cach Useful hashing functions. - Declared inline for your pleaseure. + Declared inline for your pleasure. ************************************************/ @@ -153,10 +152,10 @@ void *hash_value_for_key (cache_ptr cach manipulation of the key pointer. (Use the lowest bits except for those likely to be 0 due to alignment.) */ -static inline unsigned int +static inline unsigned int hash_ptr (cache_ptr cache, const void *key) { - return ((unsigned int)key / sizeof (void *)) & cache->mask; + return ((size_t)key / sizeof (void *)) & cache->mask; } @@ -190,7 +189,12 @@ compare_ptrs (const void *k1, const void static inline int compare_strings (const void *k1, const void *k2) { - return !strcmp (k1, k2); + if (k1 == k2) + return 1; + else if (k1 == 0 || k2 == 0) + return 0; + else + return !strcmp (k1, k2); }