* 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
This commit is contained in:
David Ayers 2004-07-21 18:58:21 +00:00
parent 15b47ef442
commit 9bcaae0c5c
2 changed files with 31 additions and 8 deletions

View file

@ -1,3 +1,9 @@
2004-07-21 David Ayers <d.ayers@inode.at>
* Source/Additions/GSObjCRuntime.m
(gs_revert_selector_names_in_list): New function.
(GSRemoveMethodList): Also revert selectors for first list.
2004-07-20 Adrian Robert <arobert@cogsci.ucsd.edu> 2004-07-20 Adrian Robert <arobert@cogsci.ucsd.edu>
* Tools/autogsdoc.m: Add 'Protocols' index to upper left index panel * Tools/autogsdoc.m: Add 'Protocols' index to upper left index panel

View file

@ -1021,6 +1021,22 @@ GSAddMethodList(Class class,
class_add_method_list(class, list); 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. */ /* See header for documentation. */
void void
GSRemoveMethodList(Class class, GSRemoveMethodList(Class class,
@ -1044,6 +1060,14 @@ GSRemoveMethodList(Class class,
{ {
class->methods = list->method_next; class->methods = list->method_next;
list->method_next = 0; 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 else
{ {
@ -1054,7 +1078,6 @@ GSRemoveMethodList(Class class,
{ {
if (current_list->method_next == list) if (current_list->method_next == list)
{ {
int i;
current_list->method_next = list->method_next; current_list->method_next = list->method_next;
list->method_next = 0; list->method_next = 0;
@ -1064,13 +1087,7 @@ GSRemoveMethodList(Class class,
so the runtime can convert them again so the runtime can convert them again
it the list gets reinserted. it the list gets reinserted.
*/ */
for (i = 0; i < list->method_count; i++) gs_revert_selector_names_in_list(list);
{
const char *name;
name = GSNameFromSelector(list->method_list[i].method_name);
list->method_list[i].method_name = (SEL)name;
}
} }
} }
} }