| /freebsd-12-stable/lib/libc/stdlib/ |
| D | heapsort.c | 88 #define CREATE(initval, nmemb, par_i, child_i, par, child, size, count, tmp) { \ argument 89 for (par_i = initval; (child_i = par_i * 2) <= nmemb; \ 92 if (child_i < nmemb && COMPAR(child, child + size) < 0) { \ 120 #define SELECT(par_i, child_i, nmemb, par, child, size, k, count, tmp1, tmp2) { \ argument 121 for (par_i = 1; (child_i = par_i * 2) <= nmemb; par_i = child_i) { \ 123 if (child_i < nmemb && COMPAR(child, child + size) < 0) { \ 158 heapsort_b(void *vbase, size_t nmemb, size_t size, heapsort_block compar) in heapsort_b() argument 161 heapsort(void *vbase, size_t nmemb, size_t size, in heapsort_b() 169 if (nmemb <= 1) in heapsort_b() 186 for (l = nmemb / 2 + 1; --l;) in heapsort_b() [all …]
|
| D | reallocarray.c | 33 reallocarray(void *optr, size_t nmemb, size_t size) in reallocarray() argument 36 if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && in reallocarray() 37 nmemb > 0 && SIZE_MAX / nmemb < size) { in reallocarray() 41 return (realloc(optr, size * nmemb)); in reallocarray()
|
| D | merge.c | 115 mergesort_b(void *base, size_t nmemb, size_t size, cmp_t cmp) in mergesort_b() argument 117 mergesort(void *base, size_t nmemb, size_t size, cmp_t cmp) in mergesort_b() 131 if (nmemb == 0) in mergesort_b() 138 if ((list2 = malloc(nmemb * size + PSIZE)) == NULL) in mergesort_b() 142 setup(list1, list2, nmemb, size, cmp); in mergesort_b() 143 last = list2 + nmemb * size; in mergesort_b() 238 last = list2 + nmemb*size; in mergesort_b() 241 memmove(list2, list1, nmemb*size); in mergesort_b()
|
| /freebsd-12-stable/crypto/openssh/ |
| D | xmalloc.c | 47 xcalloc(size_t nmemb, size_t size) in xcalloc() argument 51 if (size == 0 || nmemb == 0) in xcalloc() 53 if (SIZE_MAX / nmemb < size) in xcalloc() 55 ptr = calloc(nmemb, size); in xcalloc() 58 size * nmemb); in xcalloc() 63 xreallocarray(void *ptr, size_t nmemb, size_t size) in xreallocarray() argument 67 new_ptr = reallocarray(ptr, nmemb, size); in xreallocarray() 70 nmemb, size); in xreallocarray() 75 xrecallocarray(void *ptr, size_t onmemb, size_t nmemb, size_t size) in xrecallocarray() argument 79 new_ptr = recallocarray(ptr, onmemb, nmemb, size); in xrecallocarray() [all …]
|
| /freebsd-12-stable/usr.bin/diff/ |
| D | xmalloc.c | 42 xcalloc(size_t nmemb, size_t size) in xcalloc() argument 46 ptr = calloc(nmemb, size); in xcalloc() 48 err(2, "xcalloc: allocating %zu * %zu bytes", nmemb, size); in xcalloc() 53 xreallocarray(void *ptr, size_t nmemb, size_t size) in xreallocarray() argument 57 new_ptr = reallocarray(ptr, nmemb, size); in xreallocarray() 60 nmemb, size); in xreallocarray()
|
| /freebsd-12-stable/contrib/mandoc/ |
| D | compat_reallocarray.c | 32 reallocarray(void *optr, size_t nmemb, size_t size) in reallocarray() argument 34 if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && in reallocarray() 35 nmemb > 0 && SIZE_MAX / nmemb < size) { in reallocarray() 39 return realloc(optr, size * nmemb); in reallocarray()
|
| D | dba_write.c | 91 dba_skip(int32_t nmemb, int32_t sz) in dba_skip() argument 97 assert(nmemb > 0); in dba_skip() 98 assert(nmemb <= 5); in dba_skip() 101 if (nmemb - fwrite(&out, sizeof(out[0]), nmemb, ofp)) in dba_skip()
|
| /freebsd-12-stable/contrib/unbound/compat/ |
| D | reallocarray.c | 34 reallocarray(void *optr, size_t nmemb, size_t size) in reallocarray() argument 36 if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && in reallocarray() 37 nmemb > 0 && SIZE_MAX / nmemb < size) { in reallocarray() 41 return realloc(optr, size * nmemb); in reallocarray()
|
| /freebsd-12-stable/crypto/openssh/openbsd-compat/ |
| D | reallocarray.c | 37 reallocarray(void *optr, size_t nmemb, size_t size) in reallocarray() argument 39 if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && in reallocarray() 40 nmemb > 0 && SIZE_MAX / nmemb < size) { in reallocarray() 44 return realloc(optr, size * nmemb); in reallocarray()
|
| D | bsd-malloc.c | 37 rpl_calloc(size_t nmemb, size_t size) in rpl_calloc() argument 39 if (nmemb == 0) in rpl_calloc() 40 nmemb = 1; in rpl_calloc() 43 return calloc(nmemb, size); in rpl_calloc()
|
| D | bsd-poll.c | 52 size_t nmemb; in ppoll() local 63 nmemb = howmany(maxfd + 1 , NFDBITS); in ppoll() 64 if ((readfds = calloc(nmemb, sizeof(fd_mask))) == NULL || in ppoll() 65 (writefds = calloc(nmemb, sizeof(fd_mask))) == NULL || in ppoll() 66 (exceptfds = calloc(nmemb, sizeof(fd_mask))) == NULL) { in ppoll()
|
| /freebsd-12-stable/contrib/ntp/sntp/libpkgver/ |
| D | colcomp.c | 102 size_t nmemb = 0; in main() local 114 nmemb = sizeof ca / size; in main() 116 printf("argc is <%d>, nmemb = <%d>\n", argc, nmemb); in main() 120 for (i = 0; i < nmemb; ++i) { in main() 124 qsort((void *)base, nmemb, size, qcmp); in main() 128 for (i = 0; i < nmemb; ++i) { in main()
|
| /freebsd-12-stable/contrib/ntp/libntp/ |
| D | emalloc.c | 88 size_t nmemb, in oreallocarrayxz() argument 98 if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && in oreallocarrayxz() 99 nmemb > 0 && SIZE_MAX / nmemb < size) { in oreallocarrayxz() 110 return ereallocz(optr, extra + (size * nmemb), 0, TRUE); in oreallocarrayxz() 112 return ereallocz(optr, extra + (size * nmemb), 0, TRUE, file, line); in oreallocarrayxz()
|
| /freebsd-12-stable/contrib/ntp/libntp/lib/isc/unix/ |
| D | stdio.c | 64 isc_stdio_read(void *ptr, size_t size, size_t nmemb, FILE *f, size_t *nret) { in isc_stdio_read() argument 69 r = fread(ptr, size, nmemb, f); in isc_stdio_read() 70 if (r != nmemb) { in isc_stdio_read() 82 isc_stdio_write(const void *ptr, size_t size, size_t nmemb, FILE *f, in isc_stdio_write() argument 89 r = fwrite(ptr, size, nmemb, f); in isc_stdio_write() 90 if (r != nmemb) in isc_stdio_write()
|
| /freebsd-12-stable/sys/dev/drm2/ |
| D | drm_mem_util.h | 37 static __inline__ void *drm_calloc_large(size_t nmemb, size_t size) in drm_calloc_large() argument 40 return mallocarray(nmemb, size, DRM_MEM_DRIVER, M_NOWAIT | M_ZERO); in drm_calloc_large() 44 static __inline__ void *drm_malloc_ab(size_t nmemb, size_t size) in drm_malloc_ab() argument 47 return mallocarray(nmemb, size, DRM_MEM_DRIVER, M_NOWAIT); in drm_malloc_ab()
|
| /freebsd-12-stable/contrib/llvm-project/compiler-rt/lib/dfsan/ |
| D | dfsan_allocator.cpp | 157 void *DFsanCalloc(uptr nmemb, uptr size) { in DFsanCalloc() argument 158 if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { in DFsanCalloc() 162 ReportCallocOverflow(nmemb, size, &stack); in DFsanCalloc() 164 return DFsanAllocate(nmemb * size, sizeof(u64), true /*zeroise*/); in DFsanCalloc() 181 void *dfsan_calloc(uptr nmemb, uptr size) { in dfsan_calloc() argument 182 return SetErrnoOnNull(DFsanCalloc(nmemb, size)); in dfsan_calloc() 195 void *dfsan_reallocarray(void *ptr, uptr nmemb, uptr size) { in dfsan_reallocarray() argument 196 if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { in dfsan_reallocarray() 201 ReportReallocArrayOverflow(nmemb, size, &stack); in dfsan_reallocarray() 203 return dfsan_realloc(ptr, nmemb * size); in dfsan_reallocarray()
|
| /freebsd-12-stable/contrib/llvm-project/compiler-rt/lib/hwasan/ |
| D | hwasan_allocation_functions.cpp | 104 void *__sanitizer_calloc(uptr nmemb, uptr size) { in __sanitizer_calloc() argument 108 return AllocateFromLocalPool(nmemb * size); in __sanitizer_calloc() 109 return hwasan_calloc(nmemb, size, &stack); in __sanitizer_calloc() 130 void *__sanitizer_reallocarray(void *ptr, uptr nmemb, uptr size) { in __sanitizer_reallocarray() argument 132 return hwasan_reallocarray(ptr, nmemb, size, &stack); in __sanitizer_reallocarray() 159 INTERCEPTOR_ALIAS(void *, calloc, SIZE_T nmemb, SIZE_T size); 161 INTERCEPTOR_ALIAS(void *, reallocarray, void *ptr, SIZE_T nmemb, SIZE_T size);
|
| D | hwasan_allocator.cpp | 298 static void *HwasanCalloc(StackTrace *stack, uptr nmemb, uptr size) { in HwasanCalloc() argument 299 if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { in HwasanCalloc() 302 ReportCallocOverflow(nmemb, size, stack); in HwasanCalloc() 304 return HwasanAllocate(stack, nmemb * size, sizeof(u64), true); in HwasanCalloc() 335 void *hwasan_calloc(uptr nmemb, uptr size, StackTrace *stack) { in hwasan_calloc() argument 336 return SetErrnoOnNull(HwasanCalloc(stack, nmemb, size)); in hwasan_calloc() 349 void *hwasan_reallocarray(void *ptr, uptr nmemb, uptr size, StackTrace *stack) { in hwasan_reallocarray() argument 350 if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { in hwasan_reallocarray() 354 ReportReallocArrayOverflow(nmemb, size, stack); in hwasan_reallocarray() 356 return hwasan_realloc(ptr, nmemb * size, stack); in hwasan_reallocarray()
|
| /freebsd-12-stable/contrib/llvm-project/compiler-rt/lib/lsan/ |
| D | lsan_allocator.cpp | 107 static void *Calloc(uptr nmemb, uptr size, const StackTrace &stack) { in Calloc() argument 108 if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { in Calloc() 111 ReportCallocOverflow(nmemb, size, &stack); in Calloc() 113 size *= nmemb; in Calloc() 199 void *lsan_reallocarray(void *ptr, uptr nmemb, uptr size, in lsan_reallocarray() argument 201 if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { in lsan_reallocarray() 205 ReportReallocArrayOverflow(nmemb, size, &stack); in lsan_reallocarray() 207 return lsan_realloc(ptr, nmemb * size, stack); in lsan_reallocarray() 210 void *lsan_calloc(uptr nmemb, uptr size, const StackTrace &stack) { in lsan_calloc() argument 211 return SetErrnoOnNull(Calloc(nmemb, size, stack)); in lsan_calloc()
|
| /freebsd-12-stable/contrib/wpa/src/utils/ |
| D | os.h | 277 static inline void * os_calloc(size_t nmemb, size_t size) in os_calloc() argument 279 if (size && nmemb > (~(size_t) 0) / size) in os_calloc() 281 return os_zalloc(nmemb * size); in os_calloc() 565 static inline void * os_realloc_array(void *ptr, size_t nmemb, size_t size) in os_realloc_array() argument 567 if (size && nmemb > (~(size_t) 0) / size) in os_realloc_array() 569 return os_realloc(ptr, nmemb * size); in os_realloc_array() 579 static inline void os_remove_in_array(void *ptr, size_t nmemb, size_t size, in os_remove_in_array() argument 582 if (idx < nmemb - 1) in os_remove_in_array() 585 (nmemb - idx - 1) * size); in os_remove_in_array()
|
| /freebsd-12-stable/sys/sys/ |
| D | malloc.h | 238 void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type, 241 void *mallocarray_domainset(size_t nmemb, size_t size, struct malloc_type *type, 269 WOULD_OVERFLOW(size_t nmemb, size_t size) in WOULD_OVERFLOW() argument 272 return ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && in WOULD_OVERFLOW() 273 nmemb > 0 && __SIZE_T_MAX / nmemb < size); in WOULD_OVERFLOW()
|
| /freebsd-12-stable/contrib/llvm-project/compiler-rt/lib/msan/ |
| D | msan_allocator.cpp | 248 static void *MsanCalloc(StackTrace *stack, uptr nmemb, uptr size) { in MsanCalloc() argument 249 if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { in MsanCalloc() 252 ReportCallocOverflow(nmemb, size, stack); in MsanCalloc() 254 return MsanAllocate(stack, nmemb * size, sizeof(u64), true); in MsanCalloc() 269 void *msan_calloc(uptr nmemb, uptr size, StackTrace *stack) { in msan_calloc() argument 270 return SetErrnoOnNull(MsanCalloc(stack, nmemb, size)); in msan_calloc() 283 void *msan_reallocarray(void *ptr, uptr nmemb, uptr size, StackTrace *stack) { in msan_reallocarray() argument 284 if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { in msan_reallocarray() 288 ReportReallocArrayOverflow(nmemb, size, stack); in msan_reallocarray() 290 return msan_realloc(ptr, nmemb * size, stack); in msan_reallocarray()
|
| /freebsd-12-stable/lib/libc/tests/stdlib/ |
| D | test-sort.h | 53 ssort(int v[], int nmemb) in ssort() argument 57 for (i = 0; i < nmemb; i++) { in ssort() 58 for (j = i + 1; j < nmemb; j++) { in ssort()
|
| /freebsd-12-stable/contrib/binutils/bfd/ |
| D | libbfd.c | 182 bfd_malloc2 (bfd_size_type nmemb, bfd_size_type size) in bfd_malloc2() argument 186 if ((nmemb | size) >= HALF_BFD_SIZE_TYPE in bfd_malloc2() 188 && nmemb > ~(bfd_size_type) 0 / size) in bfd_malloc2() 194 size *= nmemb; in bfd_malloc2() 236 bfd_realloc2 (void *ptr, bfd_size_type nmemb, bfd_size_type size) in bfd_realloc2() argument 240 if ((nmemb | size) >= HALF_BFD_SIZE_TYPE in bfd_realloc2() 242 && nmemb > ~(bfd_size_type) 0 / size) in bfd_realloc2() 248 size *= nmemb; in bfd_realloc2() 297 bfd_zmalloc2 (bfd_size_type nmemb, bfd_size_type size) in bfd_zmalloc2() argument 301 if ((nmemb | size) >= HALF_BFD_SIZE_TYPE in bfd_zmalloc2() [all …]
|
| /freebsd-12-stable/contrib/unbound/util/ |
| D | alloc.c | 395 void *unbound_stat_calloc(size_t nmemb, size_t size) in unbound_stat_calloc() argument 399 if(nmemb != 0 && INT_MAX/nmemb < size) in unbound_stat_calloc() 401 s = (nmemb*size==0)?(size_t)1:nmemb*size; in unbound_stat_calloc() 405 log_info("stat %p=calloc(%u, %u)", res+16, (unsigned)nmemb, (unsigned)size); in unbound_stat_calloc() 479 void *unbound_stat_calloc_log(size_t nmemb, size_t size, const char* file, in unbound_stat_calloc_log() argument 483 (unsigned) nmemb, (unsigned)size); in unbound_stat_calloc_log() 484 return unbound_stat_calloc(nmemb, size); in unbound_stat_calloc_log() 538 void *unbound_stat_calloc_lite(size_t nmemb, size_t size, const char* file, in unbound_stat_calloc_lite() argument 543 if(nmemb != 0 && INT_MAX/nmemb < size) in unbound_stat_calloc_lite() 545 req = nmemb * size; in unbound_stat_calloc_lite()
|