diff options
author | Andrew Pinski <pinskia@physics.uc.edu> | 2004-01-28 08:00:01 +0000 |
---|---|---|
committer | Andrew Pinski <pinskia@physics.uc.edu> | 2004-01-28 08:00:01 +0000 |
commit | 772d5c4f93f68ed0503cd57b46a8711606ed857f (patch) | |
tree | d96691d9f75740c3cd044f4e46cad8821cc00e70 | |
parent | 52995a18d245893409c812100d7aa39d3971c6da (diff) |
2004-01-27 Nicola Pero <n.pero@mi.flashnet.it>
* Protocol.m ([-conformsTo:]): If the argument is nil, return NO.
([-hash], [-isEqual:]): New methods.
2004-01-27 Richard Frith-Macdonald <rfm@gnu.org>
* sarray.c (sarray_free): Add a better comment.
2004-01-27 Adam Fedor <fedor@gnu.org>
* hash.c (hash_add): Cast cachep to int.
* selector.c (__sel_register_typed_name): Cast soffset_decode to int.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/libobjc-branch@76782 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libobjc/ChangeLog.branch | 16 | ||||
-rw-r--r-- | libobjc/Protocol.m | 30 | ||||
-rw-r--r-- | libobjc/archive.c | 2 | ||||
-rw-r--r-- | libobjc/encoding.c | 2 | ||||
-rw-r--r-- | libobjc/hash.c | 4 | ||||
-rw-r--r-- | libobjc/objc/objc-api.h | 2 | ||||
-rw-r--r-- | libobjc/objc/runtime.h | 2 | ||||
-rw-r--r-- | libobjc/sarray.c | 6 | ||||
-rw-r--r-- | libobjc/selector.c | 4 | ||||
-rw-r--r-- | libobjc/sendmsg.c | 2 |
10 files changed, 57 insertions, 13 deletions
diff --git a/libobjc/ChangeLog.branch b/libobjc/ChangeLog.branch index 5495b244686..1e3a4f86e53 100644 --- a/libobjc/ChangeLog.branch +++ b/libobjc/ChangeLog.branch @@ -1,3 +1,17 @@ +2004-01-27 Nicola Pero <n.pero@mi.flashnet.it> + + * Protocol.m ([-conformsTo:]): If the argument is nil, return NO. + ([-hash], [-isEqual:]): New methods. + +2004-01-27 Richard Frith-Macdonald <rfm@gnu.org> + + * sarray.c (sarray_free): Add a better comment. + +2004-01-27 Adam Fedor <fedor@gnu.org> + + * hash.c (hash_add): Cast cachep to int. + * selector.c (__sel_register_typed_name): Cast soffset_decode to int. + 2004-01-27 Alexander Malmberg <alexander@malmberg.org> * selector.c: Rename register_selectors_from_list to @@ -30,7 +44,7 @@ * encoding.c: Remove FIXME about the warning about unused variable. - * sendmsg: Add a FIXME comment saying that + * sendmsg.c: Add a FIXME comment saying that this should be using libffi. * Makefile.in (LIBTOOL): Use @LIBTOOL@ now as it works. diff --git a/libobjc/Protocol.m b/libobjc/Protocol.m index 06a25acabbe..a18d544db40 100644 --- a/libobjc/Protocol.m +++ b/libobjc/Protocol.m @@ -1,5 +1,5 @@ /* This file contains the implementation of class Protocol. - Copyright (C) 1993 Free Software Foundation, Inc. + Copyright (C) 1993, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -56,6 +56,9 @@ struct objc_method_description_list { size_t i; struct objc_protocol_list* proto_list; + if (aProtocolObject == nil) + return NO; + if (!strcmp(aProtocolObject->protocol_name, self->protocol_name)) return YES; @@ -129,4 +132,29 @@ struct objc_method_description_list { return NULL; } +- (unsigned) hash +{ + /* Compute a hash of the protocol_name; use the same hash algorithm + * that we use for class names; protocol names and class names are + * somewhat similar types of string spaces. + */ + int hash = 0, index; + + for (index = 0; protocol_name[index] != '\0'; index++) + { + hash = (hash << 4) ^ (hash >> 28) ^ protocol_name[index]; + } + + hash = (hash ^ (hash >> 10) ^ (hash >> 20)); + + return hash; +} + +- (BOOL) isEqual: (id)obj +{ + if (strcmp (protocol_name, [obj name]) == 0) + return YES; + + return NO; +} @end diff --git a/libobjc/archive.c b/libobjc/archive.c index 8f0098bb4f8..cddc2443485 100644 --- a/libobjc/archive.c +++ b/libobjc/archive.c @@ -1,5 +1,5 @@ /* GNU Objective C Runtime archiving - Copyright (C) 1993, 1995, 1996, 1997, 2002 Free Software Foundation, Inc. + Copyright (C) 1993, 1995, 1996, 1997, 2002, 2004 Free Software Foundation, Inc. Contributed by Kresten Krab Thorup This file is part of GCC. diff --git a/libobjc/encoding.c b/libobjc/encoding.c index 2a3b2a4840a..4d45b4423df 100644 --- a/libobjc/encoding.c +++ b/libobjc/encoding.c @@ -1,5 +1,5 @@ /* Encoding of types for Objective C. - Copyright (C) 1993, 1995, 1996, 1997, 1998, 2000, 2002 + Copyright (C) 1993, 1995, 1996, 1997, 1998, 2000, 2002, 2004 Free Software Foundation, Inc. Contributed by Kresten Krab Thorup Bitfield support by Ovidiu Predescu diff --git a/libobjc/hash.c b/libobjc/hash.c index ac0da21fdee..cbea81ad424 100644 --- a/libobjc/hash.c +++ b/libobjc/hash.c @@ -1,5 +1,5 @@ /* Hash tables for Objective C internal structures - Copyright (C) 1993, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1993, 1996, 1997, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -154,7 +154,7 @@ hash_add (cache_ptr *cachep, const void *key, void *value) (*cachep)->compare_func); DEBUG_PRINTF ("Expanding cache %#x from %d to %d\n", - *cachep, (*cachep)->size, new->size); + (int) *cachep, (*cachep)->size, new->size); /* Copy the nodes from the first hash table to the new one. */ while ((node1 = hash_next (*cachep, node1))) diff --git a/libobjc/objc/objc-api.h b/libobjc/objc/objc-api.h index d5a9a28d467..9212b992aec 100644 --- a/libobjc/objc/objc-api.h +++ b/libobjc/objc/objc-api.h @@ -1,5 +1,5 @@ /* GNU Objective-C Runtime API. - Copyright (C) 1993, 1995, 1996, 1997, 2002 Free Software Foundation, Inc. + Copyright (C) 1993, 1995, 1996, 1997, 2002, 2004 Free Software Foundation, Inc. This file is part of GCC. diff --git a/libobjc/objc/runtime.h b/libobjc/objc/runtime.h index edf8e5e71c3..17a3e5e9e76 100644 --- a/libobjc/objc/runtime.h +++ b/libobjc/objc/runtime.h @@ -1,5 +1,5 @@ /* GNU Objective C Runtime internal declarations - Copyright (C) 1993, 1995, 1996, 1997, 2002 Free Software Foundation, Inc. + Copyright (C) 1993, 1995, 1996, 1997, 2002, 2004 Free Software Foundation, Inc. Contributed by Kresten Krab Thorup This file is part of GCC. diff --git a/libobjc/sarray.c b/libobjc/sarray.c index c37633ba33e..e7e69a9e8ce 100644 --- a/libobjc/sarray.c +++ b/libobjc/sarray.c @@ -1,5 +1,5 @@ /* Sparse Arrays for Objective C dispatch tables - Copyright (C) 1993, 1995, 1996, 2002 Free Software Foundation, Inc. + Copyright (C) 1993, 1995, 1996, 2002, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -459,7 +459,9 @@ sarray_free (struct sarray *array) { #endif - /* If this is a copy, go ahead and decrement/deallocate the original */ + /* If this is a copy of another array, we free it (which might just + * decrement its reference count so it will be freed when no longer in use). + */ if (array->is_copy_of) sarray_free (array->is_copy_of); diff --git a/libobjc/selector.c b/libobjc/selector.c index ae16efda400..5ff0d8c71e2 100644 --- a/libobjc/selector.c +++ b/libobjc/selector.c @@ -1,5 +1,5 @@ /* GNU Objective C Runtime selector related functions - Copyright (C) 1993, 1995, 1996, 1997, 2002 Free Software Foundation, Inc. + Copyright (C) 1993, 1995, 1996, 1997, 2002, 2004 Free Software Foundation, Inc. Contributed by Kresten Krab Thorup This file is part of GCC. @@ -435,7 +435,7 @@ __sel_register_typed_name (const char *name, const char *types, } DEBUG_PRINTF ("Record selector %s[%s] as: %ld\n", name, types, - soffset_decode (i)); + (long) soffset_decode (i)); { int is_new = (l == 0); diff --git a/libobjc/sendmsg.c b/libobjc/sendmsg.c index 9a58ca66806..f0b5bbb35c2 100644 --- a/libobjc/sendmsg.c +++ b/libobjc/sendmsg.c @@ -1,6 +1,6 @@ /* GNU Objective C Runtime message lookup Copyright (C) 1993, 1995, 1996, 1997, 1998, - 2001, 2002 Free Software Foundation, Inc. + 2001, 2002, 2004 Free Software Foundation, Inc. Contributed by Kresten Krab Thorup This file is part of GCC. |