ObjFW  Check-in [d31c0b6fc8]

Overview
Comment:Fix memory wasting in OFBigDataArray.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 0.6
Files: files | file ages | folders
SHA3-256: d31c0b6fc8e6d8ff18eb22eff7db68e5d29d784b8694b141cd4874ba6aefb755
User & Date: js on 2012-03-16 17:14:30
Other Links: branch diff | manifest | tags
Context
2012-03-21
09:23
Fix of_atomic_{add,sub}_ptr on AMD64. check-in: 10b7f839c5 user: js tags: 0.6
2012-03-16
17:14
Fix memory wasting in OFBigDataArray. check-in: d31c0b6fc8 user: js tags: 0.6
2012-03-13
20:19
Improve -[OFDictionary isEqual:]. check-in: c32750da12 user: js tags: 0.6
Changes

Modified src/OFDataArray.m from [80fa284829] to [f620eb9fde].

536
537
538
539
540
541
542
543

544
545
546
547
548
549
550
551
536
537
538
539
540
541
542

543

544
545
546
547
548
549
550







-
+
-







		@throw [OFOutOfRangeException exceptionWithClass: isa];

	lastPageByte = of_pagesize - 1;
	newSize = ((count + nItems) * itemSize + lastPageByte) & ~lastPageByte;

	if (size != newSize)
		data = [self resizeMemory: data
				 toNItems: newSize
				   toSize: newSize];
				   ofSize: itemSize];

	memmove(data + (index + nItems) * itemSize, data + index * itemSize,
	    (count - index) * itemSize);
	memcpy(data + index * itemSize, cArray, nItems * itemSize);

	count += nItems;
	size = newSize;