ObjFW  Diff

Differences From Artifact [51c24d6468]:

To Artifact [7124c4f433]:


799
800
801
802
803
804
805
806
807


808
809

810
811
812

813
814
815

816
817
818
819

820
821
822
823
824
825
826
799
800
801
802
803
804
805


806
807
808

809
810
811

812
813
814

815
816
817
818

819
820
821
822
823
824
825
826







-
-
+
+

-
+


-
+


-
+



-
+







		PRE_IVAR->lastMem->next = preMem;

	PRE_IVAR->lastMem = preMem;

	return (char*)pointer + PRE_MEM_ALIGN;
}

- (void*)allocMemoryWithItemSize: (size_t)itemSize
			   count: (size_t)count
- (void*)allocMemoryWithSize: (size_t)size
		       count: (size_t)count
{
	if (itemSize == 0 || count == 0)
	if (size == 0 || count == 0)
		return NULL;

	if (count > SIZE_MAX / itemSize)
	if (count > SIZE_MAX / size)
		@throw [OFOutOfRangeException exceptionWithClass: isa];

	return [self allocMemoryWithSize: itemSize * count];
	return [self allocMemoryWithSize: size * count];
}

- (void*)resizeMemory: (void*)pointer
	       toSize: (size_t)size
		 size: (size_t)size
{
	void *new;
	struct pre_mem *preMem;

	if (pointer == NULL)
		return [self allocMemoryWithSize: size];

851
852
853
854
855
856
857
858

859
860
861
862
863


864
865

866
867
868
869
870

871
872
873
874

875
876
877
878
879
880
881
851
852
853
854
855
856
857

858
859
860
861


862
863
864

865
866
867
868
869

870
871
872
873

874
875
876
877
878
879
880
881







-
+



-
-
+
+

-
+




-
+



-
+







			PRE_IVAR->lastMem = preMem;
	}

	return (char*)new + PRE_MEM_ALIGN;
}

- (void*)resizeMemory: (void*)pointer
	     itemSize: (size_t)itemSize
		 size: (size_t)size
		count: (size_t)count
{
	if (pointer == NULL)
		return [self allocMemoryWithItemSize: itemSize
					       count: count];
		return [self allocMemoryWithSize: size
					   count: count];

	if (itemSize == 0 || count == 0) {
	if (size == 0 || count == 0) {
		[self freeMemory: pointer];
		return NULL;
	}

	if (count > SIZE_MAX / itemSize)
	if (count > SIZE_MAX / size)
		@throw [OFOutOfRangeException exceptionWithClass: isa];

	return [self resizeMemory: pointer
			   toSize: itemSize * count];
			     size: size * count];
}

- (void)freeMemory: (void*)pointer
{
	if (pointer == NULL)
		return;

1028
1029
1030
1031
1032
1033
1034
1035
1036


1037
1038
1039
1040
1041
1042
1043

1044
1045
1046
1047
1048
1049
1050

1051
1052
1053
1054
1055
1056
1057
1028
1029
1030
1031
1032
1033
1034


1035
1036
1037
1038
1039
1040
1041
1042

1043
1044
1045
1046
1047
1048
1049

1050
1051
1052
1053
1054
1055
1056
1057







-
-
+
+






-
+






-
+







 */
+ (void*)allocMemoryWithSize: (size_t)size
{
	@throw [OFNotImplementedException exceptionWithClass: self
						    selector: _cmd];
}

+ (void*)allocMemoryWithItemSize: (size_t)itemSize
			   count: (size_t)count
+ (void*)allocMemoryWithSize: (size_t)size
		       count: (size_t)count
{
	@throw [OFNotImplementedException exceptionWithClass: self
						    selector: _cmd];
}

+ (void*)resizeMemory: (void*)pointer
	       toSize: (size_t)size
		 size: (size_t)size
{
	@throw [OFNotImplementedException exceptionWithClass: self
						    selector: _cmd];
}

+ (void*)resizeMemory: (void*)pointer
	     itemSize: (size_t)itemSize
		 size: (size_t)size
		count: (size_t)count
{
	@throw [OFNotImplementedException exceptionWithClass: self
						    selector: _cmd];
}

+ (void)freeMemory: (void*)pointer