ObjFW  Check-in [305317e5ea]

Overview
Comment:Small optimization.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 305317e5ea9a790e95a1c30809181ca57a7907fcfdc64140351355d37fb9243d
User & Date: js on 2010-01-31 22:05:33
Other Links: manifest | tags
Context
2010-02-01
14:20
More secure way to unlock spinlocks. check-in: cb6e353487 user: js tags: trunk
2010-01-31
22:05
Small optimization. check-in: 305317e5ea user: js tags: trunk
21:51
Move OFFastEnumeration protocol to OFEnumerator.h. check-in: 8347c2ef5e user: js tags: trunk
Changes

Modified src/OFMutableString.m from [5bfa0023ae] to [2a95dc6ba0].

41
42
43
44
45
46
47

48
49
50
51
52
53
54
55
56
57
58
	size_t i, j, d;
	char *nstr;

	if (!is_utf8) {
		assert(table_size >= 1);

		uint8_t *p = (uint8_t*)*string + *length;


		while (--p >= (uint8_t*)*string)
			if (table[0][*p])
				*p = table[0][*p];

		return;
	}

	ulen = [self length];
	ustr = [self allocMemoryForNItems: [self length]
				 withSize: ulen];







>


|
|







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
	size_t i, j, d;
	char *nstr;

	if (!is_utf8) {
		assert(table_size >= 1);

		uint8_t *p = (uint8_t*)*string + *length;
		uint8_t t;

		while (--p >= (uint8_t*)*string)
			if ((t = table[0][*p]) != 0)
				*p = t;

		return;
	}

	ulen = [self length];
	ustr = [self allocMemoryForNItems: [self length]
				 withSize: ulen];

Modified src/OFObject.m from [695579ca2f] to [357eadb4d2].

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# import <objc/runtime.h>
#endif
#ifdef OF_GNU_RUNTIME
# import <objc/sarray.h>
#endif

#ifdef OF_ATOMIC_OPS
#import "atomic.h"
#else
#import "threading.h"
#endif

struct pre_ivar {
	void	      **memchunks;
	size_t	      memchunks_size;
	int32_t	      retain_count; /* int32_t because atomic ops use int32_t */
#ifndef OF_ATOMIC_OPS







|

|







27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# import <objc/runtime.h>
#endif
#ifdef OF_GNU_RUNTIME
# import <objc/sarray.h>
#endif

#ifdef OF_ATOMIC_OPS
# import "atomic.h"
#else
# import "threading.h"
#endif

struct pre_ivar {
	void	      **memchunks;
	size_t	      memchunks_size;
	int32_t	      retain_count; /* int32_t because atomic ops use int32_t */
#ifndef OF_ATOMIC_OPS

Modified src/threading.h from [ec6d801a5e] to [b78d28aec0].

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#import "OFMacros.h"

#if !defined(OF_THREADS) || (!defined(OF_HAVE_PTHREADS) && !defined(_WIN32))
# error No threads available!
#endif

#if defined(OF_HAVE_PTHREADS)
#include <pthread.h>
typedef pthread_t of_thread_t;
typedef pthread_mutex_t of_mutex_t;
typedef pthread_key_t of_tlskey_t;
#elif defined(_WIN32)
#include <windows.h>
typedef HANDLE of_thread_t;
typedef CRITICAL_SECTION of_mutex_t;
typedef DWORD of_tlskey_t;
#endif

#if defined(OF_ATOMIC_OPS)
#import "atomic.h"
typedef int32_t of_spinlock_t;
#elif defined(OF_HAVE_PTHREAD_SPINLOCKS)
typedef pthread_spinlock_t of_spinlock_t;
#else
typedef pthread_mutex_t of_spinlock_t;
#endif








|




|






|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#import "OFMacros.h"

#if !defined(OF_THREADS) || (!defined(OF_HAVE_PTHREADS) && !defined(_WIN32))
# error No threads available!
#endif

#if defined(OF_HAVE_PTHREADS)
# include <pthread.h>
typedef pthread_t of_thread_t;
typedef pthread_mutex_t of_mutex_t;
typedef pthread_key_t of_tlskey_t;
#elif defined(_WIN32)
# include <windows.h>
typedef HANDLE of_thread_t;
typedef CRITICAL_SECTION of_mutex_t;
typedef DWORD of_tlskey_t;
#endif

#if defined(OF_ATOMIC_OPS)
# import "atomic.h"
typedef int32_t of_spinlock_t;
#elif defined(OF_HAVE_PTHREAD_SPINLOCKS)
typedef pthread_spinlock_t of_spinlock_t;
#else
typedef pthread_mutex_t of_spinlock_t;
#endif