From 9bcaae0c5c2e76e6f2203ded22b9dce095b3374c Mon Sep 17 00:00:00 2001 From: David Ayers Date: Wed, 21 Jul 2004 18:58:21 +0000 Subject: [PATCH] * Source/Additions/GSObjCRuntime.m (gs_revert_selector_names_in_list): New function. (GSRemoveMethodList): Also revert selectors for first list. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19759 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 6 ++++++ Source/Additions/GSObjCRuntime.m | 33 ++++++++++++++++++++++++-------- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 94ea963a0..f201d84a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-07-21 David Ayers + + * Source/Additions/GSObjCRuntime.m + (gs_revert_selector_names_in_list): New function. + (GSRemoveMethodList): Also revert selectors for first list. + 2004-07-20 Adrian Robert * Tools/autogsdoc.m: Add 'Protocols' index to upper left index panel diff --git a/Source/Additions/GSObjCRuntime.m b/Source/Additions/GSObjCRuntime.m index 20657a090..fc047a027 100644 --- a/Source/Additions/GSObjCRuntime.m +++ b/Source/Additions/GSObjCRuntime.m @@ -1021,6 +1021,22 @@ GSAddMethodList(Class class, class_add_method_list(class, list); } +GS_STATIC_INLINE void +gs_revert_selector_names_in_list(GSMethodList list) +{ + int i; + const char *name; + + for (i = 0; i < list->method_count; i++) + { + name = GSNameFromSelector(list->method_list[i].method_name); + if (name) + { + list->method_list[i].method_name = (SEL)name; + } + } +} + /* See header for documentation. */ void GSRemoveMethodList(Class class, @@ -1044,6 +1060,14 @@ GSRemoveMethodList(Class class, { class->methods = list->method_next; list->method_next = 0; + + /* + The list has become "free standing". + Replace all selector references with selector names + so the runtime can convert them again + it the list gets reinserted. + */ + gs_revert_selector_names_in_list(list); } else { @@ -1054,7 +1078,6 @@ GSRemoveMethodList(Class class, { if (current_list->method_next == list) { - int i; current_list->method_next = list->method_next; list->method_next = 0; @@ -1064,13 +1087,7 @@ GSRemoveMethodList(Class class, so the runtime can convert them again it the list gets reinserted. */ - for (i = 0; i < list->method_count; i++) - { - const char *name; - - name = GSNameFromSelector(list->method_list[i].method_name); - list->method_list[i].method_name = (SEL)name; - } + gs_revert_selector_names_in_list(list); } } }