Overview
Comment: | Get rid of dependency on getpagesize(). |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
127d6358489655c17c5cd5524c219041 |
User & Date: | js on 2009-05-24 00:18:25 |
Other Links: | manifest | tags |
Context
2009-05-24
| ||
00:26 | Better check for madvise(). check-in: 000b2dffdf user: js tags: trunk | |
00:18 | Get rid of dependency on getpagesize(). check-in: 127d635848 user: js tags: trunk | |
2009-05-23
| ||
22:07 | Add a new convenience method to OFString. check-in: 88163bd172 user: js tags: trunk | |
Changes
Modified src/OFDataArray.m from [388224bcd6] to [2a4bfcc919].
︙ | ︙ | |||
16 17 18 19 20 21 22 | #include <unistd.h> #include <limits.h> #import "OFDataArray.h" #import "OFExceptions.h" #import "OFMacros.h" | > > > > | < | 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 | @end @implementation OFBigDataArray - initWithItemSize: (size_t)is { self = [super initWithItemSize: is]; | | > > | > > > > > > > | 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; |
︙ | ︙ |
Modified src/OFStream.m from [6d62a21fd5] to [86513faaa0].
︙ | ︙ | |||
14 15 16 17 18 19 20 | #include <string.h> #include <unistd.h> #import "OFStream.h" #import "OFExceptions.h" #import "OFMacros.h" | > > > | > > > > > > > > > > > > > | 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 39 40 41 42 43 44 45 46 47 48 49 50 51 | #include <string.h> #include <unistd.h> #import "OFStream.h" #import "OFExceptions.h" #import "OFMacros.h" #ifdef _WIN32 #include <windows.h> #endif static int pagesize = 0; @implementation OFStream - init { self = [super init]; cache = NULL; #ifndef _WIN32 if (pagesize == 0) if ((pagesize = sysconf(_SC_PAGESIZE)) == -1) pagesize = 4096; #else if (pagesize == 0) { SYSTEM_INFO si; GetSystemInfo(&si); pagesize = si.dwPageSize - 1; } #endif return self; } - (size_t)readNBytes: (size_t)size intoBuffer: (char*)buf { |
︙ | ︙ | |||
73 74 75 76 77 78 79 | } return ret; } } } /* Read until we get a newline or \0 */ | | | | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | } return ret; } } } /* Read until we get a newline or \0 */ tmp = [self allocWithSize: pagesize]; for (;;) { @try { len = [self readNBytes: pagesize - 1 intoBuffer: tmp]; } @catch (OFException *e) { [self freeMem: tmp]; @throw e; } /* Look if there's a newline or \0 */ |
︙ | ︙ |