ObjFW  Check-in [c02e48e140]

Overview
Comment:Use void in declarations when we take no parameters.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c02e48e140cb9553373f4ed8a3eaa6b48b89e2d563c7e04192dc782f9fc38a01
User & Date: js on 2011-04-12 14:51:47
Other Links: manifest | tags
Context
2011-04-21
11:17
Don't call objc_thread_[add,remove} when using ObjFW-RT. check-in: 6ebbffda0d user: js tags: trunk
2011-04-12
15:26
Call objc_thread_{add,remove} when using the GNU runtime. check-in: bc76c7f2b0 user: js tags: trunk
14:51
Use void in declarations when we take no parameters. check-in: c02e48e140 user: js tags: trunk
Changes

Modified src/OFApplication.m from [470b88e078] to [f78cb5e637].

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef __MACH__
extern char **environ;
#endif

static OFApplication *app = nil;

static void
atexit_handler()
{
	id <OFApplicationDelegate> delegate = [app delegate];

	[delegate applicationWillTerminate];
}

int







|







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef __MACH__
extern char **environ;
#endif

static OFApplication *app = nil;

static void
atexit_handler(void)
{
	id <OFApplicationDelegate> delegate = [app delegate];

	[delegate applicationWillTerminate];
}

int

Modified src/OFBlock.m from [cb7452fd95] to [b5411ea8fa].

119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
static struct {
	unsigned long version, size;
	const char *name;
	void *symtab;
} module = { 8, sizeof(module), NULL, &symtab };

static void __attribute__((constructor))
constructor()
{
	__objc_exec_class(&module);
}
/* End of ObjC module */
#elif defined(OF_APPLE_RUNTIME) && !defined(__OBJC2__)
struct class {
	struct class *isa, *super_class;







|







119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
static struct {
	unsigned long version, size;
	const char *name;
	void *symtab;
} module = { 8, sizeof(module), NULL, &symtab };

static void __attribute__((constructor))
constructor(void)
{
	__objc_exec_class(&module);
}
/* End of ObjC module */
#elif defined(OF_APPLE_RUNTIME) && !defined(__OBJC2__)
struct class {
	struct class *isa, *super_class;

Modified src/OFDataArray.m from [cd9dc30a3e] to [a29caa1d81].

30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"

#import "base64.h"
#import "macros.h"

/* References for static linking */
void _references_to_categories_of_OFDataArray()
{
	_OFDataArray_Hashing_reference = 1;
};

@implementation OFDataArray
+ dataArrayWithItemSize: (size_t)is
{







|







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"

#import "base64.h"
#import "macros.h"

/* References for static linking */
void _references_to_categories_of_OFDataArray(void)
{
	_OFDataArray_Hashing_reference = 1;
};

@implementation OFDataArray
+ dataArrayWithItemSize: (size_t)is
{

Modified src/OFString.m from [88aed01d2e] to [ead9a0ea73].

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#import "of_asprintf.h"
#import "unicode.h"

extern const uint16_t of_iso_8859_15[256];
extern const uint16_t of_windows_1252[256];

/* References for static linking */
void _references_to_categories_of_OFString()
{
	_OFString_Hashing_reference = 1;
	_OFString_URLEncoding_reference = 1;
	_OFString_XMLEscaping_reference = 1;
	_OFString_XMLUnescaping_reference = 1;
};








|







50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#import "of_asprintf.h"
#import "unicode.h"

extern const uint16_t of_iso_8859_15[256];
extern const uint16_t of_windows_1252[256];

/* References for static linking */
void _references_to_categories_of_OFString(void)
{
	_OFString_Hashing_reference = 1;
	_OFString_URLEncoding_reference = 1;
	_OFString_XMLEscaping_reference = 1;
	_OFString_XMLUnescaping_reference = 1;
};

Modified src/foundation-compat.m from [1de79742c4] to [233f316a15].

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
	[OFAutoreleasePool addObject: self];

	return self;
}

static void __attribute__((constructor))
init()
{
	Class NSAutoreleasePool = objc_getClass("NSAutoreleasePool");
	Class NSObject = objc_getClass("NSObject");
	Method alloc_method;
	Method addObject_method;
	Method autorelease_method;








|







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
	[OFAutoreleasePool addObject: self];

	return self;
}

static void __attribute__((constructor))
init(void)
{
	Class NSAutoreleasePool = objc_getClass("NSAutoreleasePool");
	Class NSObject = objc_getClass("NSObject");
	Method alloc_method;
	Method addObject_method;
	Method autorelease_method;

Modified src/objc_properties.m from [8ff7710d2c] to [363b73e7b0].

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# import "threading.h"
# define NUM_SPINLOCKS 8	/* needs to be a power of 2 */
# define SPINLOCK_HASH(p) ((uintptr_t)p >> 4) & (NUM_SPINLOCKS - 1)
static of_spinlock_t spinlocks[NUM_SPINLOCKS];
#endif

BOOL
objc_properties_init()
{
#ifdef OF_THREADS
	size_t i;

	for (i = 0; i < NUM_SPINLOCKS; i++)
		if (!of_spinlock_new(&spinlocks[i]))
			return NO;







|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# import "threading.h"
# define NUM_SPINLOCKS 8	/* needs to be a power of 2 */
# define SPINLOCK_HASH(p) ((uintptr_t)p >> 4) & (NUM_SPINLOCKS - 1)
static of_spinlock_t spinlocks[NUM_SPINLOCKS];
#endif

BOOL
objc_properties_init(void)
{
#ifdef OF_THREADS
	size_t i;

	for (i = 0; i < NUM_SPINLOCKS; i++)
		if (!of_spinlock_new(&spinlocks[i]))
			return NO;

Modified src/objc_sync.m from [1376acf9a7] to [4d687d4a25].

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
		fprintf(stderr, "WARNING: %s failed in line %d!\n"	\
		    "WARNING: This might result in a race "		\
		    "condition!\n", f, __LINE__);			\
		return 1;						\
	}

BOOL
objc_sync_init()
{
	return of_mutex_new(&mutex);
}

int
objc_sync_enter(id obj)
{







|







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
		fprintf(stderr, "WARNING: %s failed in line %d!\n"	\
		    "WARNING: This might result in a race "		\
		    "condition!\n", f, __LINE__);			\
		return 1;						\
	}

BOOL
objc_sync_init(void)
{
	return of_mutex_new(&mutex);
}

int
objc_sync_enter(id obj)
{

Modified src/threading.h from [d7813d4c61] to [c1d87def31].

99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#elif defined(_WIN32)
	/* FIXME */
	return YES;
#endif
}

static OF_INLINE void
of_thread_exit()
{
#if defined(OF_HAVE_PTHREADS)
	pthread_exit(NULL);
#elif defined(_WIN32)
	ExitThread(0);
#endif
}







|







99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#elif defined(_WIN32)
	/* FIXME */
	return YES;
#endif
}

static OF_INLINE void
of_thread_exit(void)
{
#if defined(OF_HAVE_PTHREADS)
	pthread_exit(NULL);
#elif defined(_WIN32)
	ExitThread(0);
#endif
}