ObjFW  Diff

Differences From Artifact [388224bcd6]:

  • File src/OFDataArray.m — part of check-in [526d04018d] at 2009-05-23 21:53:20 on branch trunk — A few renames.

    OFArray:
    * -[add:] to -[addObject:].
    * -[last] to -[lastObject].

    OFAutoreleasePool:
    * +[addToPool:] to +[addObjectToTopmostPool:].
    * -[addToPool:] to -[addObject:].

    OFDataArray:
    * -[add:] to -[addItem:].
    * -[last] to -[lastItem].

    OFObject:
    * -[addToMemoryPool:] to -[addItemToMemoryPool:]. (user: js, size: 4781) [annotate] [blame] [check-ins using]

To Artifact [2a4bfcc919]:


16
17
18
19
20
21
22




23
24
25
26
27
28
29
30
31
#include <unistd.h>
#include <limits.h>

#import "OFDataArray.h"
#import "OFExceptions.h"
#import "OFMacros.h"





static size_t lastpagebyte = 0;
extern int getpagesize(void);

@implementation OFDataArray
+ dataArrayWithItemSize: (size_t)is
{
	return [[[self alloc] initWithItemSize: is] autorelease];
}








>
>
>
>
|
<







16
17
18
19
20
21
22
23
24
25
26
27

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

#import "OFDataArray.h"
#import "OFExceptions.h"
#import "OFMacros.h"

#ifdef _WIN32
#include <windows.h>
#endif

static int lastpagebyte = 0;


@implementation OFDataArray
+ dataArrayWithItemSize: (size_t)is
{
	return [[[self alloc] initWithItemSize: is] autorelease];
}

183
184
185
186
187
188
189
190


191







192
193
194
195
196
197
198
@end

@implementation OFBigDataArray
- initWithItemSize: (size_t)is
{
	self = [super initWithItemSize: is];

	if (lastpagebyte == 0)


		lastpagebyte = getpagesize() - 1;








	return self;
}

- addItem: (void*)item
{
	size_t nsize;







|
>
>
|
>
>
>
>
>
>
>







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
@end

@implementation OFBigDataArray
- initWithItemSize: (size_t)is
{
	self = [super initWithItemSize: is];

	if (lastpagebyte == 0) {
#ifndef _WIN32
		if ((lastpagebyte = sysconf(_SC_PAGESIZE)) == -1)
			lastpagebyte = 4096;
		lastpagebyte--;
#else
		SYSTEM_INFO si;
		GetSystemInfo(&si);
		lastpagebyte = si.dwPageSize - 1;
#endif
	}

	return self;
}

- addItem: (void*)item
{
	size_t nsize;