ObjFW  Check-in [59969f5450]

Overview
Comment:A few minor Win32 fixes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 59969f5450a5986b75c3808c6d779550ad7f8ef6a59d66d0a006f3756b3c2abb
User & Date: js on 2009-09-21 20:35:12
Other Links: manifest | tags
Context
2009-09-26
13:27
Migration of OFDictionary tests to new testing framework. check-in: a3bfa21725 user: js tags: trunk
2009-09-21
20:35
A few minor Win32 fixes. check-in: 59969f5450 user: js tags: trunk
11:26
Only check if snprintf returns required space if there's no asprintf. check-in: a6513f3228 user: js tags: trunk
Changes

Modified src/OFAutoreleasePool.m from [2c07550cc7] to [5130372aa2].

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * Pay special attention to NULL and nil in this file, they might be different!
 * Use NULL for TLS values and nil for instance variables.
 */

static of_tlskey_t first_key, last_key;

#ifndef _WIN32 /* Not used on Win32 yet */
static void
release_all(id obj)
{
	[of_tlskey_get(first_key) release];
}
#endif

@implementation OFAutoreleasePool
+ (void)initialize
{
	if (self != [OFAutoreleasePool class])
		return;








<





<







23
24
25
26
27
28
29

30
31
32
33
34

35
36
37
38
39
40
41
/*
 * Pay special attention to NULL and nil in this file, they might be different!
 * Use NULL for TLS values and nil for instance variables.
 */

static of_tlskey_t first_key, last_key;


static void
release_all(id obj)
{
	[of_tlskey_get(first_key) release];
}


@implementation OFAutoreleasePool
+ (void)initialize
{
	if (self != [OFAutoreleasePool class])
		return;

Modified src/threading.h from [fc8a803188] to [6c98cd6b3a].

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
typedef DWORD of_tlskey_t;
#endif

#ifndef _WIN32
#define of_thread_is_current(t) pthread_equal(t, pthread_self())
#define of_thread_current() pthread_self()
#else
#define of_thread_is_current(t) (t == GetCurrentThreadId())
#define of_thread_current() GetCurrentThreadId()
#endif

static OF_INLINE BOOL
of_thread_new(of_thread_t *thread, id (*main)(id), id data)
{
#ifndef _WIN32
	return (pthread_create(thread, NULL, (void*(*)(void*))main,
	    (void*)data) ? NO : YES);
#else
	*thread = CreateThread(NULL, 0, (void*(*)(void*))main,
	    (void*)data, 0, NULL);

	return (thread == NULL ? NO : YES);
#endif
}

static OF_INLINE BOOL







|
|









|







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
typedef DWORD of_tlskey_t;
#endif

#ifndef _WIN32
#define of_thread_is_current(t) pthread_equal(t, pthread_self())
#define of_thread_current() pthread_self()
#else
#define of_thread_is_current(t) (t == GetCurrentThread())
#define of_thread_current() GetCurrentThread()
#endif

static OF_INLINE BOOL
of_thread_new(of_thread_t *thread, id (*main)(id), id data)
{
#ifndef _WIN32
	return (pthread_create(thread, NULL, (void*(*)(void*))main,
	    (void*)data) ? NO : YES);
#else
	*thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)main,
	    (void*)data, 0, NULL);

	return (thread == NULL ? NO : YES);
#endif
}

static OF_INLINE BOOL