Home | History | Annotate | Download | only in share

Lines Matching refs:size1

86 static inline void *safe_malloc_add_2op_(size_t size1, size_t size2)
88 size2 += size1;
89 if(size2 < size1)
94 static inline void *safe_malloc_add_3op_(size_t size1, size_t size2, size_t size3)
96 size2 += size1;
97 if(size2 < size1)
105 static inline void *safe_malloc_add_4op_(size_t size1, size_t size2, size_t size3, size_t size4)
107 size2 += size1;
108 if(size2 < size1)
119 void *safe_malloc_mul_2op_(size_t size1, size_t size2) ;
121 static inline void *safe_malloc_mul_3op_(size_t size1, size_t size2, size_t size3)
123 if(!size1 || !size2 || !size3)
125 if(size1 > SIZE_MAX / size2)
127 size1 *= size2;
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)
136 if(!size1 || !size2)
138 if(size1 > SIZE_MAX / size2)
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))
151 if(size1 > SIZE_MAX / size2)
153 return malloc(size1*size2);
164 static inline void *safe_realloc_add_2op_(void *ptr, size_t size1, size_t size2)
166 size2 += size1;
167 if(size2 < size1) {
174 static inline void *safe_realloc_add_3op_(void *ptr, size_t size1, size_t size2, size_t size3)
176 size2 += size1;
177 if(size2 < size1)
185 static inline void *safe_realloc_add_4op_(void *ptr, size_t size1, size_t size2, size_t size3, size_t size4)
187 size2 += size1;
188 if(size2 < size1)
199 static inline void *safe_realloc_mul_2op_(void *ptr, size_t size1, size_t size2)
201 if(!size1 || !size2)
203 if(size1 > SIZE_MAX / size2)
205 return safe_realloc_(ptr, size1*size2);
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))
216 return safe_realloc_mul_2op_(ptr, size1, size2);