* Source/Additions/GSObjCRuntime.m (BDBGPrintf) New macro.

(GSObjCAddClassBehavior, GSObjCAddMethods): Use new macro.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19457 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
ayers 2004-06-04 13:42:13 +00:00
parent a601bb2853
commit cf3354b37f
2 changed files with 24 additions and 36 deletions

View file

@ -1,5 +1,8 @@
2004-06-03 David Ayers <d.ayers@inode.at> 2004-06-03 David Ayers <d.ayers@inode.at>
* Source/Additions/GSObjCRuntime.m (BDBGPrintf) New macro.
(GSObjCAddClassBehavior, GSObjCAddMethods): Use new macro.
* Source/GSSet.m (-[GSMutableSet unionSet:]): Remove redundant * Source/GSSet.m (-[GSMutableSet unionSet:]): Remove redundant
test. test.

View file

@ -62,6 +62,9 @@
@end @end
#endif #endif
#define BDBGPrintf(format, args...) \
do { if (behavior_debug) { fprintf(stderr, (format), ## args); } } while (0)
static objc_mutex_t local_lock = NULL; static objc_mutex_t local_lock = NULL;
/* This class it intended soley for thread safe / +load safe /* This class it intended soley for thread safe / +load safe
@ -647,11 +650,8 @@ GSObjCAddMethods (Class class, struct objc_method_list *methods)
{ {
struct objc_method *method = &(mlist->method_list[counter]); struct objc_method *method = &(mlist->method_list[counter]);
if (behavior_debug) BDBGPrintf(" processing method [%s] ... ",
{ GSNameFromSelector(method->method_name));
fprintf(stderr, " processing method [%s] ... ",
GSNameFromSelector(method->method_name));
}
if (!search_for_method_in_class(class,method->method_name) if (!search_for_method_in_class(class,method->method_name)
&& !sel_eq(method->method_name, initialize_sel)) && !sel_eq(method->method_name, initialize_sel))
@ -661,14 +661,12 @@ GSObjCAddMethods (Class class, struct objc_method_list *methods)
methods override the superclasses' methods. */ methods override the superclasses' methods. */
new_list->method_list[new_list->method_count] = *method; new_list->method_list[new_list->method_count] = *method;
(new_list->method_count)++; (new_list->method_count)++;
if (behavior_debug)
{ BDBGPrintf("added.\n");
fprintf(stderr, "added.\n");
}
} }
else if (behavior_debug) else
{ {
fprintf(stderr, "ignored.\n"); BDBGPrintf("ignored.\n");
} }
counter -= 1; counter -= 1;
} }
@ -754,13 +752,11 @@ GSObjCAddMethods (Class class, struct objc_method_list *methods)
while (counter >= 0) while (counter >= 0)
{ {
struct objc_method *method = &(mlist->method_list[counter]); struct objc_method *method = &(mlist->method_list[counter]);
const char *name = GSNameFromSelector(method->method_name); const char *name = GSNameFromSelector(method->method_name);
BDBGPrintf(" processing method [%s] ... ", name);
if (behavior_debug)
{
fprintf(stderr, " processing method [%s] ... ", name);
}
if (!search_for_method_in_list(class->methods, method->method_name) if (!search_for_method_in_list(class->methods, method->method_name)
&& !sel_eq(method->method_name, initialize_sel)) && !sel_eq(method->method_name, initialize_sel))
{ {
@ -777,14 +773,12 @@ GSObjCAddMethods (Class class, struct objc_method_list *methods)
new_list->method_list[new_list->method_count].method_name new_list->method_list[new_list->method_count].method_name
= (SEL)name; = (SEL)name;
(new_list->method_count)++; (new_list->method_count)++;
if (behavior_debug)
{ BDBGPrintf("added.\n");
fprintf(stderr, "added.\n");
}
} }
else if (behavior_debug) else
{ {
fprintf(stderr, "ignored.\n"); BDBGPrintf("ignored.\n");
} }
counter -= 1; counter -= 1;
} }
@ -1084,16 +1078,10 @@ GSObjCAddClassBehavior(Class receiver, Class behavior)
receiver->instance_size = behavior->instance_size; receiver->instance_size = behavior->instance_size;
} }
if (behavior_debug) BDBGPrintf("Adding behavior to class %s\n", receiver->name);
{ BDBGPrintf(" instance methods from %s\n", behavior->name);
fprintf(stderr, "Adding behavior to class %s\n", receiver->name);
}
/* Add instance methods */ /* Add instance methods */
if (behavior_debug)
{
fprintf(stderr, "Adding instance methods from %s\n", behavior->name);
}
#if NeXT_RUNTIME #if NeXT_RUNTIME
{ {
void *iterator = 0; void *iterator = 0;
@ -1111,11 +1099,8 @@ GSObjCAddClassBehavior(Class receiver, Class behavior)
#endif #endif
/* Add class methods */ /* Add class methods */
if (behavior_debug) BDBGPrintf("Adding class methods from %s\n",
{ behavior->class_pointer->name);
fprintf(stderr, "Adding class methods from %s\n",
behavior->class_pointer->name);
}
#if NeXT_RUNTIME #if NeXT_RUNTIME
{ {
void *iterator = 0; void *iterator = 0;