ObjFW  Diff

Differences From Artifact [8a522b1fcf]:

To Artifact [960649af1d]:


136
137
138
139
140
141
142
143

144
145

146
147
148
149
150
151
152
136
137
138
139
140
141
142

143
144

145
146
147
148
149
150
151
152







-
+

-
+







# endif
			}

			return page;
		}
	}

	page = of_malloc(1, sizeof(*page));
	page = of_alloc(1, sizeof(*page));
	@try {
		page->map = of_calloc(1, mapSize);
		page->map = of_alloc_zeroed(1, mapSize);
	} @catch (id e) {
		free(page);
		@throw e;
	}
	@try {
		page->page = mapPages(1);
	} @catch (id e) {
290
291
292
293
294
295
296
297

298
299
300
301
302
303
304
290
291
292
293
294
295
296

297
298
299
300
301
302
303
304







-
+







	size_t numPreallocatedPages;
# endif
	size_t i;

	if (preallocatedPages != NULL)
		@throw [OFInvalidArgumentException exception];

	preallocatedPages = of_calloc(numPages, sizeof(struct page));
	preallocatedPages = of_alloc_zeroed(numPages, sizeof(struct page));
# if !defined(OF_HAVE_COMPILER_TLS) && defined(OF_HAVE_THREADS)
	of_tlskey_set(preallocatedPagesKey, preallocatedPages);
# endif

	@try {
		for (i = 0; i < numPages; i++)
			preallocatedPages[i] = addPage(false);
411
412
413
414
415
416
417
418

419
420
421
422
423
424
425
411
412
413
414
415
416
417

418
419
420
421
422
423
424
425







-
+







		size_t pageSize = [OFSystemInfo pageSize];
#endif

		if (count > SIZE_MAX / itemSize)
			@throw [OFOutOfRangeException exception];

		if (allowsSwappableMemory) {
			_items = of_malloc(count, itemSize);
			_items = of_alloc(count, itemSize);
			_freeWhenDone = true;
			memset(_items, 0, count * itemSize);
#if defined(HAVE_MMAP) && defined(HAVE_MLOCK) && defined(MAP_ANON)
		} else if (count * itemSize >= pageSize)
			_items = mapPages(OF_ROUND_UP_POW2(pageSize,
			    count * itemSize) / pageSize);
		else {