diff options
author | Nicola Pero <nicola.pero@meta-innovation.com> | 2010-12-24 20:10:46 +0000 |
---|---|---|
committer | Nicola Pero <nicola@gcc.gnu.org> | 2010-12-24 20:10:46 +0000 |
commit | 9cacfc3eb3244d1f0a17481c75df331cd9d5a749 (patch) | |
tree | 82ccf00b97041686d44ec777ecbed412ef03db12 /libobjc/selector.c | |
parent | 410644c41a1b10798a0fe442c66f9bf582ecf067 (diff) | |
download | gcc-9cacfc3eb3244d1f0a17481c75df331cd9d5a749.tar.gz |
In libobjc/: 2010-12-24 Nicola Pero <nicola.pero@meta-innovation.com>
In libobjc/:
2010-12-24 Nicola Pero <nicola.pero@meta-innovation.com>
* selector.c (sel_getTypedSelector): Return NULL if given a NULL
argument.
(sel_registerTypedName): Same.
(sel_registerName): Same.
* objc/runtime.h: Updated documentation.
In gcc/testsuite/:
2010-12-24 Nicola Pero <nicola.pero@meta-innovation.com>
* objc.dg/gnu-api-2-sel.m: Test calling sel_getUid,
sel_registerName and sel_registerTypedName with NULL arguments.
Updated the test to work with the Apple runtime as well.
* obj-c++.dg/gnu-api-2-sel.mm: Same change.
From-SVN: r168231
Diffstat (limited to 'libobjc/selector.c')
-rw-r--r-- | libobjc/selector.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libobjc/selector.c b/libobjc/selector.c index f8a7f14fdb1..4110df2662b 100644 --- a/libobjc/selector.c +++ b/libobjc/selector.c @@ -357,8 +357,12 @@ SEL sel_getTypedSelector (const char *name) { sidx i; - objc_mutex_lock (__objc_runtime_mutex); + if (name == NULL) + return NULL; + + objc_mutex_lock (__objc_runtime_mutex); + /* Look for a typed selector. */ i = (sidx) objc_hash_value_for_key (__objc_selector_hash, name); if (i != 0) @@ -658,6 +662,9 @@ SEL sel_registerName (const char *name) { SEL ret; + + if (name == NULL) + return NULL; objc_mutex_lock (__objc_runtime_mutex); /* Assume that name is not constant static memory and needs to be @@ -680,6 +687,9 @@ sel_registerTypedName (const char *name, const char *type) { SEL ret; + if (name == NULL) + return NULL; + objc_mutex_lock (__objc_runtime_mutex); /* Assume that name and type are not constant static memory and need to be copied before put into a runtime structure. is_const == |