Home | History | Annotate | Download | only in share

Lines Matching full:size3

94 static inline void *safe_malloc_add_3op_(size_t size1, size_t size2, size_t size3)
99 size3 += size2;
100 if(size3 < size2)
102 return safe_malloc_(size3);
105 static inline void *safe_malloc_add_4op_(size_t size1, size_t size2, size_t size3, size_t size4)
110 size3 += size2;
111 if(size3 < size2)
113 size4 += size3;
114 if(size4 < size3)
121 static inline void *safe_malloc_mul_3op_(size_t size1, size_t size2, size_t size3)
123 if(!size1 || !size2 || !size3)
128 if(size1 > SIZE_MAX / size3)
130 return malloc(size1*size3);
133 /* size1*size2 + size3 */
134 static inline void *safe_malloc_mul2add_(size_t size1, size_t size2, size_t size3)
137 return safe_malloc_(size3);
140 return safe_malloc_add_2op_(size1*size2, size3);
143 /* size1 * (size2 + size3) */
144 static inline void *safe_malloc_muladd2_(size_t size1, size_t size2, size_t size3)
146 if(!size1 || (!size2 && !size3))
148 size2 += size3;
149 if(size2 < size3)
174 static inline void *safe_realloc_add_3op_(void *ptr, size_t size1, size_t size2, size_t size3)
179 size3 += size2;
180 if(size3 < size2)
182 return realloc(ptr, size3);
185 static inline void *safe_realloc_add_4op_(void *ptr, size_t size1, size_t size2, size_t size3, size_t size4)
190 size3 += size2;
191 if(size3 < size2)
193 size4 += size3;
194 if(size4 < size3)
208 /* size1 * (size2 + size3) */
209 static inline void *safe_realloc_muladd2_(void *ptr, size_t size1, size_t size2, size_t size3)
211 if(!size1 || (!size2 && !size3))
213 size2 += size3;
214 if(size2 < size3)