ObjFW  Diff

Differences From Artifact [36eb4908b4]:

To Artifact [8a19fb2a3a]:


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41





42
43
44
45
46
47
48
#include "config.h"

#import "OFObject.h"

static SEL cxx_construct = NULL;
static SEL cxx_destruct = NULL;

static void __attribute__((constructor))
init(void)
{
	if (cxx_construct == NULL)
		cxx_construct = sel_registerName(".cxx_construct");
	if (cxx_destruct == NULL)
		cxx_destruct = sel_registerName(".cxx_destruct");
}

id
objc_constructInstance(Class cls, void *bytes)
{
	id obj = (id)bytes;
	BOOL (*last)(id, SEL) = NULL;

	if (cls == Nil || bytes == NULL)
		return nil;






	object_setClass(obj, cls);

	/* FIXME: Constructors of superclasses should be called first */
	for (; cls != Nil; cls = class_getSuperclass(cls)) {
		BOOL (*ctor)(id, SEL);

		if (class_respondsToSelector(cls, cxx_construct)) {







<
<
<
<
<
<
<
<
<









>
>
>
>
>







17
18
19
20
21
22
23









24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "config.h"

#import "OFObject.h"

static SEL cxx_construct = NULL;
static SEL cxx_destruct = NULL;










id
objc_constructInstance(Class cls, void *bytes)
{
	id obj = (id)bytes;
	BOOL (*last)(id, SEL) = NULL;

	if (cls == Nil || bytes == NULL)
		return nil;

	if (cxx_construct == NULL)
		cxx_construct = sel_registerName(".cxx_construct");
	if (cxx_destruct == NULL)
		cxx_destruct = sel_registerName(".cxx_destruct");

	object_setClass(obj, cls);

	/* FIXME: Constructors of superclasses should be called first */
	for (; cls != Nil; cls = class_getSuperclass(cls)) {
		BOOL (*ctor)(id, SEL);

		if (class_respondsToSelector(cls, cxx_construct)) {