ObjFW  Check-in [bab9dd49fe]

Overview
Comment:Add more ARC type qualifiers.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: bab9dd49fe4283fbcc88f919db063ac3d6695cdbd6626d914af4726f3242ee68
User & Date: js on 2012-08-19 21:27:17
Other Links: manifest | tags
Context
2012-08-19
21:27
Don't use main as variable name. check-in: 43e45e2364 user: js tags: trunk
21:27
Add more ARC type qualifiers. check-in: bab9dd49fe user: js tags: trunk
14:05
Always install autorelease.h. check-in: c7cd1e7c28 user: js tags: trunk
Changes

Modified src/OFEnumerator.h from [7994a3a6fa] to [24f3965058].

60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
 * \brief State information for fast enumerations.
 */
typedef struct of_fast_enumeration_state_t {
	/// Arbitrary state information for the enumeration
	unsigned long state;
	/// Pointer to a C array of objects to return
	id *itemsPtr;
	/// Arbitrary state information to detect mutations
	unsigned long *mutationsPtr;
	/// Additional arbitrary state information
	unsigned long extra[5];
} of_fast_enumeration_state_t;
#endif








|







60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
 * \brief State information for fast enumerations.
 */
typedef struct of_fast_enumeration_state_t {
	/// Arbitrary state information for the enumeration
	unsigned long state;
	/// Pointer to a C array of objects to return
	__unsafe_unretained id *itemsPtr;
	/// Arbitrary state information to detect mutations
	unsigned long *mutationsPtr;
	/// Additional arbitrary state information
	unsigned long extra[5];
} of_fast_enumeration_state_t;
#endif

Modified src/OFList.h from [04386cad3b] to [edc02fcf57].

28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
 */
struct of_list_object_t {
	/// A pointer to the next list object in the list
	of_list_object_t *next;
	/// A pointer to the previous list object in the list
	of_list_object_t *previous;
	/// The object for the list object
	id		 object;
};

/**
 * \brief A class which provides easy to use double-linked lists.
 */
@interface OFList: OFObject <OFCopying, OFCollection, OFSerialization>
{







|







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
 */
struct of_list_object_t {
	/// A pointer to the next list object in the list
	of_list_object_t *next;
	/// A pointer to the previous list object in the list
	of_list_object_t *previous;
	/// The object for the list object
	__unsafe_unretained id object;
};

/**
 * \brief A class which provides easy to use double-linked lists.
 */
@interface OFList: OFObject <OFCopying, OFCollection, OFSerialization>
{

Modified src/OFObject.h from [0b56356200] to [add59de5c9].

57
58
59
60
61
62
63


64
65
66
67
68
69
70
#else
# define OF_RETURNS_RETAINED
# define OF_RETURNS_NOT_RETAINED
# define OF_RETURNS_INNER_POINTER
# define OF_CONSUMED
# define OF_WEAK_UNAVAILABLE
# define __unsafe_unretained


#endif

#define OF_RETAIN_COUNT_MAX UINT_MAX
#define OF_INVALID_INDEX SIZE_MAX

/**
 * \brief A result of a comparison.







>
>







57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#else
# define OF_RETURNS_RETAINED
# define OF_RETURNS_NOT_RETAINED
# define OF_RETURNS_INNER_POINTER
# define OF_CONSUMED
# define OF_WEAK_UNAVAILABLE
# define __unsafe_unretained
# define __bridge
# define __autoreleasing
#endif

#define OF_RETAIN_COUNT_MAX UINT_MAX
#define OF_INVALID_INDEX SIZE_MAX

/**
 * \brief A result of a comparison.

Modified src/OFStreamObserver.h from [d71501a357] to [8754133d3a].

76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
 *
 * Note: Currently, Win32 can only observe sockets and not files!
 */
@interface OFStreamObserver: OFObject
{
	OFMutableArray *readStreams;
	OFMutableArray *writeStreams;
	OFStream **FDToStream;
	size_t maxFD;
	OFMutableArray *queue;
	OFDataArray *queueInfo, *queueFDs;
	id <OFStreamObserverDelegate> delegate;
	int cancelFD[2];
#ifdef _WIN32
	struct sockaddr_in cancelAddr;







|







76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
 *
 * Note: Currently, Win32 can only observe sockets and not files!
 */
@interface OFStreamObserver: OFObject
{
	OFMutableArray *readStreams;
	OFMutableArray *writeStreams;
	__unsafe_unretained OFStream **FDToStream;
	size_t maxFD;
	OFMutableArray *queue;
	OFDataArray *queueInfo, *queueFDs;
	id <OFStreamObserverDelegate> delegate;
	int cancelFD[2];
#ifdef _WIN32
	struct sockaddr_in cancelAddr;

Modified src/runtime/runtime.h from [802118dfd1] to [b190fb62d1].

19
20
21
22
23
24
25

26
27

28
29
30
31
32
33
34
#include <stdint.h>

#ifndef __has_feature
# define __has_feature(x) 0
#endif

#if __has_feature(objc_arc)

# define OBJC_BRIDGE __bridge
#else

# define OBJC_BRIDGE
#endif

typedef struct objc_class *Class;
typedef struct objc_object *id;
typedef const struct objc_selector *SEL;
typedef signed char BOOL;







>


>







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <stdint.h>

#ifndef __has_feature
# define __has_feature(x) 0
#endif

#if __has_feature(objc_arc)
# define OBJC_UNSAFE_UNRETAINED __unsafe_unretained
# define OBJC_BRIDGE __bridge
#else
# define OBJC_UNSAFE_UNRETAINED
# define OBJC_BRIDGE
#endif

typedef struct objc_class *Class;
typedef struct objc_object *id;
typedef const struct objc_selector *SEL;
typedef signed char BOOL;
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83

struct objc_selector {
	uintptr_t uid;
	const char *types;
};

struct objc_super {
	id self;
	Class cls;
};

struct objc_method {
	struct objc_selector sel;
	IMP imp;
};







|







71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

struct objc_selector {
	uintptr_t uid;
	const char *types;
};

struct objc_super {
	OBJC_UNSAFE_UNRETAINED id self;
	Class cls;
};

struct objc_method {
	struct objc_selector sel;
	IMP imp;
};
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#else
} Protocol;
#endif

struct objc_protocol_list {
	struct objc_protocol_list *next;
	long count;
	Protocol *list[1];
};

#define Nil (Class)0
#define nil (id)0
#define YES (BOOL)1
#define NO  (BOOL)0








|







152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#else
} Protocol;
#endif

struct objc_protocol_list {
	struct objc_protocol_list *next;
	long count;
	OBJC_UNSAFE_UNRETAINED Protocol *list[1];
};

#define Nil (Class)0
#define nil (id)0
#define YES (BOOL)1
#define NO  (BOOL)0

218
219
220
221
222
223
224
225
226
227
228
229

230
231
232
{
	return class_getName(object_getClass(obj));
}

static inline BOOL
class_isMetaClass(Class cls_)
{
	struct objc_class *cls = (struct objc_class*)cls_;

	return (cls->info & OBJC_CLASS_INFO_METACLASS);
}


#undef OBJC_BRIDGE

#endif







|




>



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
{
	return class_getName(object_getClass(obj));
}

static inline BOOL
class_isMetaClass(Class cls_)
{
	struct objc_class *cls = (OBJC_BRIDGE struct objc_class*)cls_;

	return (cls->info & OBJC_CLASS_INFO_METACLASS);
}

#undef OBJC_UNSAFE_UNRETAINED
#undef OBJC_BRIDGE

#endif

Modified src/threading.h from [a1aae6b58b] to [e7e86967b9].

67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#endif

static OF_INLINE BOOL
of_thread_new(of_thread_t *thread, id (*main)(id), id data)
{
#if defined(OF_HAVE_PTHREADS)
	return !pthread_create(thread, NULL, (void*(*)(void*))main,
	    (void*)data);
#elif defined(_WIN32)
	*thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)main,
	    (void*)data, 0, NULL);

	return (thread != NULL);
#endif
}

static OF_INLINE BOOL
of_thread_join(of_thread_t thread)







|


|







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#endif

static OF_INLINE BOOL
of_thread_new(of_thread_t *thread, id (*main)(id), id data)
{
#if defined(OF_HAVE_PTHREADS)
	return !pthread_create(thread, NULL, (void*(*)(void*))main,
	    (__bridge void*)data);
#elif defined(_WIN32)
	*thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)main,
	    (__bridge void*)data, 0, NULL);

	return (thread != NULL);
#endif
}

static OF_INLINE BOOL
of_thread_join(of_thread_t thread)