ObjFW  Check-in [e55ca11653]

Overview
Comment:runtime: get_method(): Look in categories first
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e55ca11653633bb8722dd63eae310367929254bd7533f5613c251ea4298d17a3
User & Date: js on 2017-06-05 01:07:26
Other Links: manifest | tags
Context
2017-06-05
12:50
OFStream: More range checks check-in: 577f0a744b user: js tags: trunk
01:07
runtime: get_method(): Look in categories first check-in: e55ca11653 user: js tags: trunk
2017-06-04
23:41
Add designated initializer to all exceptions check-in: cc5923d6bb user: js tags: trunk
Changes

Modified src/runtime/class.m from [ac59d0cf50] to [aedf6b0f5f].

672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697





698
699
700
701
702
703
704

static struct objc_method *
get_method(Class cls, SEL sel)
{
	struct objc_method_list *ml;
	struct objc_category **cats;

	for (ml = cls->methodlist; ml != NULL; ml = ml->next)
		for (unsigned int i = 0; i < ml->count; i++)
			if (sel_isEqual((SEL)&ml->methods[i].sel, sel))
				return &ml->methods[i];

	if ((cats = objc_categories_for_class(cls)) != NULL) {
		for (; *cats != NULL; cats++) {
			if (cls->info & OBJC_CLASS_INFO_METACLASS)
				ml = (*cats)->class_methods;
			else
				ml = (*cats)->instance_methods;

			for (; ml != NULL; ml = ml->next)
				for (unsigned int i = 0; i < ml->count; i++)
					if (sel_isEqual(
					    (SEL)&ml->methods[i].sel, sel))
						return &ml->methods[i];
		}
	}






	return NULL;
}

static void
add_method(Class cls, SEL sel, IMP imp, const char *types)
{







<
<
<
<
<














>
>
>
>
>







672
673
674
675
676
677
678





679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704

static struct objc_method *
get_method(Class cls, SEL sel)
{
	struct objc_method_list *ml;
	struct objc_category **cats;






	if ((cats = objc_categories_for_class(cls)) != NULL) {
		for (; *cats != NULL; cats++) {
			if (cls->info & OBJC_CLASS_INFO_METACLASS)
				ml = (*cats)->class_methods;
			else
				ml = (*cats)->instance_methods;

			for (; ml != NULL; ml = ml->next)
				for (unsigned int i = 0; i < ml->count; i++)
					if (sel_isEqual(
					    (SEL)&ml->methods[i].sel, sel))
						return &ml->methods[i];
		}
	}

	for (ml = cls->methodlist; ml != NULL; ml = ml->next)
		for (unsigned int i = 0; i < ml->count; i++)
			if (sel_isEqual((SEL)&ml->methods[i].sel, sel))
				return &ml->methods[i];

	return NULL;
}

static void
add_method(Class cls, SEL sel, IMP imp, const char *types)
{