Lines Matching refs:need
96 static inline bool size_multiply_overflow(size_t size, size_t need) { in size_multiply_overflow() argument
97 return _unlikely_(need != 0 && size > (SIZE_MAX / need)); in size_multiply_overflow()
100 _malloc_ _alloc_(1, 2) static inline void *malloc_multiply(size_t size, size_t need) { in malloc_multiply() argument
101 if (size_multiply_overflow(size, need)) in malloc_multiply()
104 return malloc(size * need ?: 1); in malloc_multiply()
108 _alloc_(2, 3) static inline void *reallocarray(void *p, size_t need, size_t size) { in reallocarray() argument
109 if (size_multiply_overflow(size, need)) in reallocarray()
112 return realloc(p, size * need ?: 1); in reallocarray()
116 _alloc_(2, 3) static inline void *memdup_multiply(const void *p, size_t size, size_t need) { in memdup_multiply() argument
117 if (size_multiply_overflow(size, need)) in memdup_multiply()
120 return memdup(p, size * need); in memdup_multiply()
125 static inline void *memdup_suffix0_multiply(const void *p, size_t size, size_t need) { in memdup_suffix0_multiply() argument
126 if (size_multiply_overflow(size, need)) in memdup_suffix0_multiply()
129 return memdup_suffix0(p, size * need); in memdup_suffix0_multiply()
132 void* greedy_realloc(void **p, size_t need, size_t size);
133 void* greedy_realloc0(void **p, size_t need, size_t size);
135 #define GREEDY_REALLOC(array, need) \ argument
136 greedy_realloc((void**) &(array), (need), sizeof((array)[0]))
138 #define GREEDY_REALLOC0(array, need) \ argument
139 greedy_realloc0((void**) &(array), (need), sizeof((array)[0]))