@@ -10,24 +10,17 @@ */ #include "config.h" #include -#include #include #import "OFStream.h" #import "OFString.h" #import "OFExceptions.h" #import "macros.h" -#ifdef _WIN32 -# include -#endif - -static int pagesize = 0; - @implementation OFStream - init { self = [super init]; @@ -35,22 +28,10 @@ @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; 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; } - (BOOL)atEndOfStream { @@ -142,11 +123,11 @@ } } } /* Read until we get a newline or \0 */ - tmp = [self allocMemoryWithSize: pagesize]; + tmp = [self allocMemoryWithSize: of_pagesize]; @try { for (;;) { if ([self atEndOfStreamWithoutCache]) { if (cache == NULL) @@ -166,11 +147,11 @@ cache_len = 0; return ret; } - len = [self readNBytesWithoutCache: pagesize + len = [self readNBytesWithoutCache: of_pagesize intoBuffer: tmp]; /* Look if there's a newline or \0 */ for (i = 0; i < len; i++) { if (OF_UNLIKELY(tmp[i] == '\n' || @@ -283,11 +264,11 @@ } } } /* Read until we get the delimiter or \0 */ - tmp = [self allocMemoryWithSize: pagesize]; + tmp = [self allocMemoryWithSize: of_pagesize]; @try { for (;;) { if ([self atEndOfStreamWithoutCache]) { if (cache == NULL) @@ -302,11 +283,11 @@ cache_len = 0; return ret; } - len = [self readNBytesWithoutCache: pagesize + len = [self readNBytesWithoutCache: of_pagesize intoBuffer: tmp]; /* Look if there's the delimiter or \0 */ for (i = 0; i < len; i++) { if (tmp[i] != delim[j++])