Commit 270a1283 by David Ayers Committed by Andrew Pinski

re PR libobjc/19024 (name collisions libobjc/libmysqlclient)

2005-03-02  David Ayers  <d.ayers@inode.at>

        PR libobjc/19024
        * Makefile.in (OBJS): Add hash_compat.lo.
        (OBJS_GC): Add hash_compat_gc.lo.
        (hash_compat_gc.lo): New target and rule.
        * objc/hash.h (hash_new, hash_delete, hash_add, hash_remove)
        (hash_next, hash_value_for_key, hash_is_key_in_hash)
        (hash_ptr, hash_string, compare_ptrs, compare_strings): Prefix
        with objc_.  Add deprecated non prefixed inlined versions.
        (OBJC_IGNORE_DEPRECATED_API): New macro to hide deprecated
        declarations.
        * hash.c (hash_new, hash_delete, hash_add, hash_remove, hash_next)
        (hash_value_for_key, hash_is_key_in_hash): Prefix with objc_ and
        update callers.
        * hash_compat.c: New file.
        * archive.c: Update callers.
        * init.c: Likewise.
        * selector.c: Likewise.
        * libobjc.def: Add objc_ versions of hash functions.

From-SVN: r95793
parent 13396b14
2005-03-02 David Ayers <d.ayers@inode.at>
PR libobjc/19024
* Makefile.in (OBJS): Add hash_compat.lo.
(OBJS_GC): Add hash_compat_gc.lo.
(hash_compat_gc.lo): New target and rule.
* objc/hash.h (hash_new, hash_delete, hash_add, hash_remove)
(hash_next, hash_value_for_key, hash_is_key_in_hash)
(hash_ptr, hash_string, compare_ptrs, compare_strings): Prefix
with objc_. Add deprecated non prefixed inlined versions.
(OBJC_IGNORE_DEPRECATED_API): New macro to hide deprecated
declarations.
* hash.c (hash_new, hash_delete, hash_add, hash_remove, hash_next)
(hash_value_for_key, hash_is_key_in_hash): Prefix with objc_ and
update callers.
* hash_compat.c: New file.
* archive.c: Update callers.
* init.c: Likewise.
* selector.c: Likewise.
* libobjc.def: Add objc_ versions of hash functions.
2005-02-28 Andrew Pinski <pinskia@physics.uc.edu> 2005-02-28 Andrew Pinski <pinskia@physics.uc.edu>
PR libobjc/20252 PR libobjc/20252
......
...@@ -146,13 +146,13 @@ OBJC_H = hash.h objc-list.h sarray.h objc.h objc-api.h \ ...@@ -146,13 +146,13 @@ OBJC_H = hash.h objc-list.h sarray.h objc.h objc-api.h \
OBJS = archive.lo class.lo encoding.lo gc.lo hash.lo init.lo linking.lo \ OBJS = archive.lo class.lo encoding.lo gc.lo hash.lo init.lo linking.lo \
misc.lo nil_method.lo NXConstStr.lo Object.lo objects.lo \ misc.lo nil_method.lo NXConstStr.lo Object.lo objects.lo \
Protocol.lo sarray.lo selector.lo sendmsg.lo thr.lo \ Protocol.lo sarray.lo selector.lo sendmsg.lo thr.lo \
$(OBJC_THREAD_FILE).lo exception.lo $(OBJC_THREAD_FILE).lo exception.lo hash_compat.lo
OBJS_GC = archive_gc.lo class_gc.lo encoding_gc.lo gc_gc.lo hash_gc.lo \ OBJS_GC = archive_gc.lo class_gc.lo encoding_gc.lo gc_gc.lo hash_gc.lo \
init_gc.lo linking_gc.lo misc_gc.lo nil_method_gc.lo \ init_gc.lo linking_gc.lo misc_gc.lo nil_method_gc.lo \
NXConstStr_gc.lo Object_gc.lo objects_gc.lo Protocol_gc.lo \ NXConstStr_gc.lo Object_gc.lo objects_gc.lo Protocol_gc.lo \
sarray_gc.lo selector_gc.lo sendmsg_gc.lo thr_gc.lo \ sarray_gc.lo selector_gc.lo sendmsg_gc.lo thr_gc.lo \
$(OBJC_THREAD_FILE)_gc.lo exception_gc.lo $(OBJC_THREAD_FILE)_gc.lo exception_gc.lo hash_compat_gc.lo
runtime-info.h: runtime-info.h:
echo "" > tmp-runtime.m echo "" > tmp-runtime.m
...@@ -183,6 +183,10 @@ hash_gc.lo: hash.c ...@@ -183,6 +183,10 @@ hash_gc.lo: hash.c
$(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
$(INCLUDES) $< $(INCLUDES) $<
hash_compat_gc.lo: hash_compat.c
$(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
$(INCLUDES) $<
init_gc.lo: init.c init_gc.lo: init.c
$(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \ $(LIBTOOL_COMPILE) $(CC) -c -o $@ $(ALL_CFLAGS) $(OBJC_GCFLAGS) \
$(INCLUDES) $< $(INCLUDES) $<
......
...@@ -40,8 +40,8 @@ Boston, MA 02111-1307, USA. */ ...@@ -40,8 +40,8 @@ Boston, MA 02111-1307, USA. */
((cache)->size * 2) ((cache)->size * 2)
cache_ptr cache_ptr
hash_new (unsigned int size, hash_func_type hash_func, objc_hash_new (unsigned int size, hash_func_type hash_func,
compare_func_type compare_func) compare_func_type compare_func)
{ {
cache_ptr cache; cache_ptr cache;
...@@ -77,7 +77,7 @@ hash_new (unsigned int size, hash_func_type hash_func, ...@@ -77,7 +77,7 @@ hash_new (unsigned int size, hash_func_type hash_func,
void void
hash_delete (cache_ptr cache) objc_hash_delete (cache_ptr cache)
{ {
node_ptr node; node_ptr node;
node_ptr next_node; node_ptr next_node;
...@@ -85,17 +85,17 @@ hash_delete (cache_ptr cache) ...@@ -85,17 +85,17 @@ hash_delete (cache_ptr cache)
/* Purge all key/value pairs from the table. */ /* Purge all key/value pairs from the table. */
/* Step through the nodes one by one and remove every node WITHOUT /* Step through the nodes one by one and remove every node WITHOUT
using hash_next. this makes hash_delete much more efficient. */ using objc_hash_next. this makes objc_hash_delete much more efficient. */
for (i = 0;i < cache->size;i++) { for (i = 0;i < cache->size;i++) {
if ((node = cache->node_table[i])) { if ((node = cache->node_table[i])) {
/* an entry in the hash table has been found, now step through the /* an entry in the hash table has been found, now step through the
nodes next in the list and free them. */ nodes next in the list and free them. */
while ((next_node = node->next)) { while ((next_node = node->next)) {
hash_remove (cache,node->key); objc_hash_remove (cache,node->key);
node = next_node; node = next_node;
} }
hash_remove (cache,node->key); objc_hash_remove (cache,node->key);
} }
} }
...@@ -106,7 +106,7 @@ hash_delete (cache_ptr cache) ...@@ -106,7 +106,7 @@ hash_delete (cache_ptr cache)
void void
hash_add (cache_ptr *cachep, const void *key, void *value) objc_hash_add (cache_ptr *cachep, const void *key, void *value)
{ {
size_t indx = (*(*cachep)->hash_func)(*cachep, key); size_t indx = (*(*cachep)->hash_func)(*cachep, key);
node_ptr node = (node_ptr) objc_calloc (1, sizeof (struct cache_node)); node_ptr node = (node_ptr) objc_calloc (1, sizeof (struct cache_node));
...@@ -149,19 +149,19 @@ hash_add (cache_ptr *cachep, const void *key, void *value) ...@@ -149,19 +149,19 @@ hash_add (cache_ptr *cachep, const void *key, void *value)
primitive functions thereby increasing its primitive functions thereby increasing its
correctness. */ correctness. */
node_ptr node1 = NULL; node_ptr node1 = NULL;
cache_ptr new = hash_new (EXPANSION (*cachep), cache_ptr new = objc_hash_new (EXPANSION (*cachep),
(*cachep)->hash_func, (*cachep)->hash_func,
(*cachep)->compare_func); (*cachep)->compare_func);
DEBUG_PRINTF ("Expanding cache %#x from %d to %d\n", DEBUG_PRINTF ("Expanding cache %#x from %d to %d\n",
(int) *cachep, (*cachep)->size, new->size); (int) *cachep, (*cachep)->size, new->size);
/* Copy the nodes from the first hash table to the new one. */ /* Copy the nodes from the first hash table to the new one. */
while ((node1 = hash_next (*cachep, node1))) while ((node1 = objc_hash_next (*cachep, node1)))
hash_add (&new, node1->key, node1->value); objc_hash_add (&new, node1->key, node1->value);
/* Trash the old cache. */ /* Trash the old cache. */
hash_delete (*cachep); objc_hash_delete (*cachep);
/* Return a pointer to the new hash table. */ /* Return a pointer to the new hash table. */
*cachep = new; *cachep = new;
...@@ -170,7 +170,7 @@ hash_add (cache_ptr *cachep, const void *key, void *value) ...@@ -170,7 +170,7 @@ hash_add (cache_ptr *cachep, const void *key, void *value)
void void
hash_remove (cache_ptr cache, const void *key) objc_hash_remove (cache_ptr cache, const void *key)
{ {
size_t indx = (*cache->hash_func)(cache, key); size_t indx = (*cache->hash_func)(cache, key);
node_ptr node = cache->node_table[indx]; node_ptr node = cache->node_table[indx];
...@@ -206,7 +206,7 @@ hash_remove (cache_ptr cache, const void *key) ...@@ -206,7 +206,7 @@ hash_remove (cache_ptr cache, const void *key)
node_ptr node_ptr
hash_next (cache_ptr cache, node_ptr node) objc_hash_next (cache_ptr cache, node_ptr node)
{ {
/* If the scan is being started then reset the last node /* If the scan is being started then reset the last node
visitied pointer and bucket index. */ visitied pointer and bucket index. */
...@@ -246,7 +246,7 @@ hash_next (cache_ptr cache, node_ptr node) ...@@ -246,7 +246,7 @@ hash_next (cache_ptr cache, node_ptr node)
Return NULL if the KEY is not recorded. */ Return NULL if the KEY is not recorded. */
void * void *
hash_value_for_key (cache_ptr cache, const void *key) objc_hash_value_for_key (cache_ptr cache, const void *key)
{ {
node_ptr node = cache->node_table[(*cache->hash_func)(cache, key)]; node_ptr node = cache->node_table[(*cache->hash_func)(cache, key)];
void *retval = NULL; void *retval = NULL;
...@@ -267,7 +267,7 @@ hash_value_for_key (cache_ptr cache, const void *key) ...@@ -267,7 +267,7 @@ hash_value_for_key (cache_ptr cache, const void *key)
Return NO if it does not */ Return NO if it does not */
BOOL BOOL
hash_is_key_in_hash (cache_ptr cache, const void *key) objc_hash_is_key_in_hash (cache_ptr cache, const void *key)
{ {
node_ptr node = cache->node_table[(*cache->hash_func)(cache, key)]; node_ptr node = cache->node_table[(*cache->hash_func)(cache, key)];
......
/* Binary compatibility hash implementations for Objective C.
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* As a special exception, if you link this library with files
compiled with GCC to produce an executable, this does not cause
the resulting executable to be covered by the GNU General Public License.
This exception does not however invalidate any other reasons why
the executable file might be covered by the GNU General Public License. */
#define OBJC_IGNORE_DEPRECATED_API 1
#include "hash.h"
cache_ptr
hash_new (unsigned int size,
hash_func_type hash_func,
compare_func_type compare_func)
{
return objc_hash_new(size, hash_func, compare_func);
}
void
hash_delete(cache_ptr cache)
{
objc_hash_delete(cache);
}
void
hash_add (cache_ptr *cachep, const void *key, void *value)
{
objc_hash_add(cachep, key, value);
}
void
hash_remove (cache_ptr cache, const void *key)
{
objc_hash_remove (cache, key);
}
node_ptr
hash_next (cache_ptr cache, node_ptr node)
{
return objc_hash_next (cache, node);
}
void *
hash_value_for_key (cache_ptr cache, const void *key)
{
return objc_hash_value_for_key (cache, key);
}
BOOL
hash_is_key_in_hash (cache_ptr cache, const void *key)
{
return objc_hash_is_key_in_hash (cache, key);
}
unsigned int
hash_ptr (cache_ptr cache, const void *key)
{
return objc_hash_ptr (cache, key);
}
unsigned int
hash_string (cache_ptr cache, const void *key)
{
return objc_hash_string (cache, key);
}
int
compare_ptrs (const void *k1, const void *k2)
{
return objc_compare_ptrs (k1, k2);
}
int
compare_strings (const void *k1, const void *k2)
{
return objc_compare_strings (k1, k2);
}
...@@ -363,10 +363,12 @@ __objc_send_message_in_list (MethodList_t method_list, Class class, SEL op) ...@@ -363,10 +363,12 @@ __objc_send_message_in_list (MethodList_t method_list, Class class, SEL op)
Method_t mth = &method_list->method_list[i]; Method_t mth = &method_list->method_list[i];
if (mth->method_name && sel_eq (mth->method_name, op) if (mth->method_name && sel_eq (mth->method_name, op)
&& ! hash_is_key_in_hash (__objc_load_methods, mth->method_imp)) && ! objc_hash_is_key_in_hash (__objc_load_methods, mth->method_imp))
{ {
/* Add this method into the +load hash table */ /* Add this method into the +load hash table */
hash_add (&__objc_load_methods, mth->method_imp, mth->method_imp); objc_hash_add (&__objc_load_methods,
mth->method_imp,
mth->method_imp);
DEBUG_PRINTF ("sending +load in class: %s\n", class->name); DEBUG_PRINTF ("sending +load in class: %s\n", class->name);
...@@ -538,8 +540,9 @@ __objc_exec_class (Module_t module) ...@@ -538,8 +540,9 @@ __objc_exec_class (Module_t module)
__objc_init_class_tables (); __objc_init_class_tables ();
__objc_init_dispatch_tables (); __objc_init_dispatch_tables ();
__objc_class_tree_list = list_cons (NULL, __objc_class_tree_list); __objc_class_tree_list = list_cons (NULL, __objc_class_tree_list);
__objc_load_methods __objc_load_methods = objc_hash_new (128,
= hash_new (128, (hash_func_type)hash_ptr, compare_ptrs); (hash_func_type)objc_hash_ptr,
objc_compare_ptrs);
previous_constructors = 1; previous_constructors = 1;
} }
......
...@@ -22,6 +22,7 @@ LIBRARY libobjc ...@@ -22,6 +22,7 @@ LIBRARY libobjc
EXPORTS EXPORTS
search_for_method_in_list search_for_method_in_list
objc_get_uninstalled_dtable objc_get_uninstalled_dtable
objc_hash_is_key_in_hash
hash_is_key_in_hash hash_is_key_in_hash
objc_verror objc_verror
_objc_load_callback _objc_load_callback
...@@ -155,9 +156,15 @@ sarray_lazy_copy ...@@ -155,9 +156,15 @@ sarray_lazy_copy
sarray_new sarray_new
sarray_realloc sarray_realloc
sarray_remove_garbage sarray_remove_garbage
objc_hash_add
hash_add hash_add
objc_hash_delete
hash_delete hash_delete
objc_hash_new
hash_new hash_new
objc_hash_next
hash_next hash_next
objc_hash_remove
hash_remove hash_remove
objc_hash_value_for_key
hash_value_for_key hash_value_for_key
...@@ -62,7 +62,7 @@ typedef struct cache_node ...@@ -62,7 +62,7 @@ typedef struct cache_node
* *
* Unfortunately there is a mutual data structure reference problem with this * Unfortunately there is a mutual data structure reference problem with this
* typedef. Therefore, to remove compiler warnings the functions passed to * typedef. Therefore, to remove compiler warnings the functions passed to
* hash_new will have to be casted to this type. * objc_hash_new will have to be casted to this type.
*/ */
typedef unsigned int (*hash_func_type) (void *, const void *); typedef unsigned int (*hash_func_type) (void *, const void *);
...@@ -111,25 +111,25 @@ extern cache_ptr module_hash_table, class_hash_table; ...@@ -111,25 +111,25 @@ extern cache_ptr module_hash_table, class_hash_table;
/* Allocate and initialize a hash table. */ /* Allocate and initialize a hash table. */
cache_ptr hash_new (unsigned int size, cache_ptr objc_hash_new (unsigned int size,
hash_func_type hash_func, hash_func_type hash_func,
compare_func_type compare_func); compare_func_type compare_func);
/* Deallocate all of the hash nodes and the cache itself. */ /* Deallocate all of the hash nodes and the cache itself. */
void hash_delete (cache_ptr cache); void objc_hash_delete (cache_ptr cache);
/* Add the key/value pair to the hash table. If the /* Add the key/value pair to the hash table. If the
hash table reaches a level of fullness then it will be resized. hash table reaches a level of fullness then it will be resized.
assert if the key is already in the hash. */ assert if the key is already in the hash. */
void hash_add (cache_ptr *cachep, const void *key, void *value); void objc_hash_add (cache_ptr *cachep, const void *key, void *value);
/* Remove the key/value pair from the hash table. /* Remove the key/value pair from the hash table.
assert if the key isn't in the table. */ assert if the key isn't in the table. */
void hash_remove (cache_ptr cache, const void *key); void objc_hash_remove (cache_ptr cache, const void *key);
/* Used to index through the hash table. Start with NULL /* Used to index through the hash table. Start with NULL
to get the first entry. to get the first entry.
...@@ -140,15 +140,15 @@ void hash_remove (cache_ptr cache, const void *key); ...@@ -140,15 +140,15 @@ void hash_remove (cache_ptr cache, const void *key);
Cache nodes are returned such that key or value can Cache nodes are returned such that key or value can
be extracted. */ be extracted. */
node_ptr hash_next (cache_ptr cache, node_ptr node); node_ptr objc_hash_next (cache_ptr cache, node_ptr node);
/* Used to return a value from a hash table using a given key. */ /* Used to return a value from a hash table using a given key. */
void *hash_value_for_key (cache_ptr cache, const void *key); void *objc_hash_value_for_key (cache_ptr cache, const void *key);
/* Used to determine if the given key exists in the hash table */ /* Used to determine if the given key exists in the hash table */
BOOL hash_is_key_in_hash (cache_ptr cache, const void *key); BOOL objc_hash_is_key_in_hash (cache_ptr cache, const void *key);
/************************************************ /************************************************
...@@ -163,7 +163,7 @@ BOOL hash_is_key_in_hash (cache_ptr cache, const void *key); ...@@ -163,7 +163,7 @@ BOOL hash_is_key_in_hash (cache_ptr cache, const void *key);
except for those likely to be 0 due to alignment.) */ 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) objc_hash_ptr (cache_ptr cache, const void *key)
{ {
return ((size_t)key / sizeof (void *)) & cache->mask; return ((size_t)key / sizeof (void *)) & cache->mask;
} }
...@@ -172,7 +172,7 @@ hash_ptr (cache_ptr cache, const void *key) ...@@ -172,7 +172,7 @@ hash_ptr (cache_ptr cache, const void *key)
/* Calculate a hash code by iterating over a NULL /* Calculate a hash code by iterating over a NULL
terminate string. */ terminate string. */
static inline unsigned int static inline unsigned int
hash_string (cache_ptr cache, const void *key) objc_hash_string (cache_ptr cache, const void *key)
{ {
unsigned int ret = 0; unsigned int ret = 0;
unsigned int ctr = 0; unsigned int ctr = 0;
...@@ -189,7 +189,7 @@ hash_string (cache_ptr cache, const void *key) ...@@ -189,7 +189,7 @@ hash_string (cache_ptr cache, const void *key)
/* Compare two pointers for equality. */ /* Compare two pointers for equality. */
static inline int static inline int
compare_ptrs (const void *k1, const void *k2) objc_compare_ptrs (const void *k1, const void *k2)
{ {
return (k1 == k2); return (k1 == k2);
} }
...@@ -197,7 +197,7 @@ compare_ptrs (const void *k1, const void *k2) ...@@ -197,7 +197,7 @@ compare_ptrs (const void *k1, const void *k2)
/* Compare two strings. */ /* Compare two strings. */
static inline int static inline int
compare_strings (const void *k1, const void *k2) objc_compare_strings (const void *k1, const void *k2)
{ {
if (k1 == k2) if (k1 == k2)
return 1; return 1;
...@@ -207,6 +207,107 @@ compare_strings (const void *k1, const void *k2) ...@@ -207,6 +207,107 @@ compare_strings (const void *k1, const void *k2)
return ! strcmp ((const char *) k1, (const char *) k2); return ! strcmp ((const char *) k1, (const char *) k2);
} }
#ifndef OBJC_IGNORE_DEPRECATED_API
/* Deprecated as of 4.1 */
static inline cache_ptr
hash_new (unsigned int size,
hash_func_type hash_func,
compare_func_type compare_func) __attribute__ ((deprecated));
static inline cache_ptr
hash_new (unsigned int size,
hash_func_type hash_func,
compare_func_type compare_func)
{
return objc_hash_new(size, hash_func, compare_func);
}
static inline void
hash_delete(cache_ptr cache) __attribute__ ((deprecated));
static inline void
hash_delete(cache_ptr cache)
{
objc_hash_delete(cache);
}
static inline void
hash_add (cache_ptr *cachep,
const void *key,
void *value) __attribute__ ((deprecated));
static inline void
hash_add (cache_ptr *cachep, const void *key, void *value)
{
objc_hash_add(cachep, key, value);
}
static inline void
hash_remove (cache_ptr cache, const void *key) __attribute__ ((deprecated));
static inline void
hash_remove (cache_ptr cache, const void *key)
{
objc_hash_remove (cache, key);
}
static inline node_ptr
hash_next (cache_ptr cache, node_ptr node) __attribute__ ((deprecated));
static inline node_ptr
hash_next (cache_ptr cache, node_ptr node)
{
return objc_hash_next (cache, node);
}
static inline void *
hash_value_for_key (cache_ptr cache,
const void *key) __attribute__ ((deprecated));
static inline void *
hash_value_for_key (cache_ptr cache, const void *key)
{
return objc_hash_value_for_key (cache, key);
}
static inline BOOL
hash_is_key_in_hash (cache_ptr cache,
const void *key) __attribute__ ((deprecated));
static inline BOOL
hash_is_key_in_hash (cache_ptr cache, const void *key)
{
return objc_hash_is_key_in_hash (cache, key);
}
static inline unsigned int
hash_ptr (cache_ptr cache, const void *key) __attribute__ ((deprecated));
static inline unsigned int
hash_ptr (cache_ptr cache, const void *key)
{
return objc_hash_ptr (cache, key);
}
static inline unsigned int
hash_string (cache_ptr cache, const void *key) __attribute__ ((deprecated));
static inline unsigned int
hash_string (cache_ptr cache, const void *key)
{
return objc_hash_string (cache, key);
}
static inline int
compare_ptrs (const void *k1, const void *k2) __attribute__ ((deprecated));
static inline int
compare_ptrs (const void *k1, const void *k2)
{
return objc_compare_ptrs (k1, k2);
}
static inline int
compare_strings (const void *k1, const void *k2) __attribute__ ((deprecated));
static inline int
compare_strings (const void *k1, const void *k2)
{
return objc_compare_strings (k1, k2);
}
#endif /* IGNORE_DEPRECATED_API */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
......
...@@ -43,9 +43,9 @@ void __objc_init_selector_tables (void) ...@@ -43,9 +43,9 @@ void __objc_init_selector_tables (void)
__objc_selector_array = sarray_new (SELECTOR_HASH_SIZE, 0); __objc_selector_array = sarray_new (SELECTOR_HASH_SIZE, 0);
__objc_selector_names = sarray_new (SELECTOR_HASH_SIZE, 0); __objc_selector_names = sarray_new (SELECTOR_HASH_SIZE, 0);
__objc_selector_hash __objc_selector_hash
= hash_new (SELECTOR_HASH_SIZE, = objc_hash_new (SELECTOR_HASH_SIZE,
(hash_func_type) hash_string, (hash_func_type) objc_hash_string,
(compare_func_type) compare_strings); (compare_func_type) objc_compare_strings);
} }
/* This routine is given a class and records all of the methods in its class /* This routine is given a class and records all of the methods in its class
...@@ -195,7 +195,7 @@ sel_get_typed_uid (const char *name, const char *types) ...@@ -195,7 +195,7 @@ sel_get_typed_uid (const char *name, const char *types)
objc_mutex_lock (__objc_runtime_mutex); objc_mutex_lock (__objc_runtime_mutex);
i = (sidx) hash_value_for_key (__objc_selector_hash, name); i = (sidx) objc_hash_value_for_key (__objc_selector_hash, name);
if (i == 0) if (i == 0)
{ {
objc_mutex_unlock (__objc_runtime_mutex); objc_mutex_unlock (__objc_runtime_mutex);
...@@ -235,7 +235,7 @@ sel_get_any_typed_uid (const char *name) ...@@ -235,7 +235,7 @@ sel_get_any_typed_uid (const char *name)
objc_mutex_lock (__objc_runtime_mutex); objc_mutex_lock (__objc_runtime_mutex);
i = (sidx) hash_value_for_key (__objc_selector_hash, name); i = (sidx) objc_hash_value_for_key (__objc_selector_hash, name);
if (i == 0) if (i == 0)
{ {
objc_mutex_unlock (__objc_runtime_mutex); objc_mutex_unlock (__objc_runtime_mutex);
...@@ -266,7 +266,7 @@ sel_get_any_uid (const char *name) ...@@ -266,7 +266,7 @@ sel_get_any_uid (const char *name)
objc_mutex_lock (__objc_runtime_mutex); objc_mutex_lock (__objc_runtime_mutex);
i = (sidx) hash_value_for_key (__objc_selector_hash, name); i = (sidx) objc_hash_value_for_key (__objc_selector_hash, name);
if (soffset_decode (i) == 0) if (soffset_decode (i) == 0)
{ {
objc_mutex_unlock (__objc_runtime_mutex); objc_mutex_unlock (__objc_runtime_mutex);
...@@ -368,7 +368,7 @@ __sel_register_typed_name (const char *name, const char *types, ...@@ -368,7 +368,7 @@ __sel_register_typed_name (const char *name, const char *types,
sidx i; sidx i;
struct objc_list *l; struct objc_list *l;
i = (sidx) hash_value_for_key (__objc_selector_hash, name); i = (sidx) objc_hash_value_for_key (__objc_selector_hash, name);
if (soffset_decode (i) != 0) if (soffset_decode (i) != 0)
{ {
for (l = (struct objc_list *) sarray_get_safe (__objc_selector_array, i); for (l = (struct objc_list *) sarray_get_safe (__objc_selector_array, i);
...@@ -453,7 +453,7 @@ __sel_register_typed_name (const char *name, const char *types, ...@@ -453,7 +453,7 @@ __sel_register_typed_name (const char *name, const char *types,
sarray_at_put_safe (__objc_selector_names, i, (void *) new_name); sarray_at_put_safe (__objc_selector_names, i, (void *) new_name);
sarray_at_put_safe (__objc_selector_array, i, (void *) l); sarray_at_put_safe (__objc_selector_array, i, (void *) l);
if (is_new) if (is_new)
hash_add (&__objc_selector_hash, (void *) new_name, (void *) i); objc_hash_add (&__objc_selector_hash, (void *) new_name, (void *) i);
} }
sarray_realloc (__objc_uninstalled_dtable, __objc_selector_max_index + 1); sarray_realloc (__objc_uninstalled_dtable, __objc_selector_max_index + 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment