Differences From Artifact [51c24d6468]:
- File
src/OFObject.m
— part of check-in
[f7576a66ce]
at
2012-06-06 13:47:52
on branch trunk
— Slightly change the memory management API.
Also fix a bug where OFBigDataArray would waste memory. (user: js, size: 25006) [annotate] [blame] [check-ins using]
To Artifact [7124c4f433]:
- File src/OFObject.m — part of check-in [11d3d69a22] at 2012-06-10 13:28:05 on branch trunk — More API improvements. (user: js, size: 24924) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
799 800 801 802 803 804 805 | PRE_IVAR->lastMem->next = preMem; PRE_IVAR->lastMem = preMem; return (char*)pointer + PRE_MEM_ALIGN; } | | | | | | | | 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*)allocMemoryWithSize: (size_t)size count: (size_t)count { if (size == 0 || count == 0) return NULL; if (count > SIZE_MAX / size) @throw [OFOutOfRangeException exceptionWithClass: isa]; return [self allocMemoryWithSize: size * count]; } - (void*)resizeMemory: (void*)pointer size: (size_t)size { void *new; struct pre_mem *preMem; if (pointer == NULL) return [self allocMemoryWithSize: size]; |
︙ | ︙ | |||
851 852 853 854 855 856 857 | PRE_IVAR->lastMem = preMem; } return (char*)new + PRE_MEM_ALIGN; } - (void*)resizeMemory: (void*)pointer | | | | | | | | 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 size: (size_t)size count: (size_t)count { if (pointer == NULL) return [self allocMemoryWithSize: size count: count]; if (size == 0 || count == 0) { [self freeMemory: pointer]; return NULL; } if (count > SIZE_MAX / size) @throw [OFOutOfRangeException exceptionWithClass: isa]; return [self resizeMemory: pointer size: size * count]; } - (void)freeMemory: (void*)pointer { if (pointer == NULL) return; |
︙ | ︙ | |||
1028 1029 1030 1031 1032 1033 1034 | */ + (void*)allocMemoryWithSize: (size_t)size { @throw [OFNotImplementedException exceptionWithClass: self selector: _cmd]; } | | | | | | 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*)allocMemoryWithSize: (size_t)size count: (size_t)count { @throw [OFNotImplementedException exceptionWithClass: self selector: _cmd]; } + (void*)resizeMemory: (void*)pointer size: (size_t)size { @throw [OFNotImplementedException exceptionWithClass: self selector: _cmd]; } + (void*)resizeMemory: (void*)pointer size: (size_t)size count: (size_t)count { @throw [OFNotImplementedException exceptionWithClass: self selector: _cmd]; } + (void)freeMemory: (void*)pointer |
︙ | ︙ |