Patchwork libobjc - minor tidyups

login
register
mail settings
Submitter Nicola Pero
Date Oct. 12, 2010, 12:27 a.m.
Message ID <1286843225.203223227@192.168.2.229>
Download mbox | patch
Permalink /patch/67496/
State New
Headers show

Comments

Nicola Pero - Oct. 12, 2010, 12:27 a.m.
A couple of minor tidyups in libobjc.  Committed to trunk.

Thanks

2010-10-12  Nicola Pero  <nicola.pero@meta-innovation.com>

        * selector.c (sel_getName): Return "<null selector>" for a NULL
        argument.
        (sel_get_name): Return 0 for a NULL argument.
        * objc/runtime.h (sel_getName): Updated documentation.

        * objc-private/hash.h (class_hash_table): Unused declaration
        removed.
        (module_hash_table): Same.
        * objc/deprecated/hash.h: Same changes.

Patch

Index: objc-private/hash.h
===================================================================
--- objc-private/hash.h	(revision 165343)
+++ objc-private/hash.h	(working copy)
@@ -104,9 +104,6 @@  typedef struct cache
 } *cache_ptr;
 
 
-/* Two important hash tables.  */
-extern cache_ptr module_hash_table, class_hash_table;
-
 /* Allocate and initialize a hash table.  */ 
 
 cache_ptr objc_hash_new (unsigned int size,
Index: selector.c
===================================================================
--- selector.c	(revision 165343)
+++ selector.c	(working copy)
@@ -293,6 +293,9 @@  const char *sel_getName (SEL selector)
 {
   const char *ret;
 
+  if (selector == NULL)
+    return "<null selector>";
+
   objc_mutex_lock (__objc_runtime_mutex);
   if ((soffset_decode ((sidx)selector->sel_id) > 0)
       && (soffset_decode ((sidx)selector->sel_id) <= __objc_selector_max_index))
@@ -306,6 +309,9 @@  const char *sel_getName (SEL selector)
 /* Traditional GNU Objective-C Runtime API.  */
 const char *sel_get_name (SEL selector)
 {
+  if (selector == NULL)
+    return 0;
+
   return sel_getName (selector);
 }
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 165343)
+++ ChangeLog	(working copy)
@@ -1,3 +1,15 @@ 
+2010-10-12  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+	* selector.c (sel_getName): Return "<null selector>" for a NULL
+	argument.
+	(sel_get_name): Return 0 for a NULL argument.
+	* objc/runtime.h (sel_getName): Updated documentation.
+
+	* objc-private/hash.h (class_hash_table): Unused declaration
+	removed.
+	(module_hash_table): Same.
+	* objc/deprecated/hash.h: Same changes.
+	
 2010-10-11  Nicola Pero  <nicola.pero@meta-innovation.com>
 
 	* class.c (objc_getClassList): New.
Index: objc/deprecated/hash.h
===================================================================
--- objc/deprecated/hash.h	(revision 165343)
+++ objc/deprecated/hash.h	(working copy)
@@ -104,9 +104,6 @@  typedef struct cache
 } *cache_ptr;
 
 
-/* Two important hash tables.  */
-extern cache_ptr module_hash_table, class_hash_table;
-
 /* Allocate and initialize a hash table.  */ 
 
 cache_ptr objc_hash_new (unsigned int size,
Index: objc/runtime.h
===================================================================
--- objc/runtime.h	(revision 165343)
+++ objc/runtime.h	(working copy)
@@ -168,7 +168,8 @@  object_getClass (id object)
 
 /** Implementation: the following functions are in selector.c.  */
 
-/* Return the name of a given selector.  */
+/* Return the name of a given selector.  If 'selector' is NULL, return
+   "<null selector>".  */
 objc_EXPORT const char *sel_getName (SEL selector);
 
 /* Return the type of a given selector.