Home
last modified time | relevance | path

Searched refs:nmemb (Results 1 – 25 of 96) sorted by relevance

1234

/freebsd/lib/libc/stdlib/
H A Dheapsort.c82 #define CREATE(initval, nmemb, par_i, child_i, par, child, size, count, tmp) { \ argument
83 for (par_i = initval; (child_i = par_i * 2) <= nmemb; \
86 if (child_i < nmemb && COMPAR(child, child + size) < 0) { \
114 #define SELECT(par_i, child_i, nmemb, par, child, size, k, count, tmp1, tmp2) { \ argument
115 for (par_i = 1; (child_i = par_i * 2) <= nmemb; par_i = child_i) { \
117 if (child_i < nmemb && COMPAR(child, child + size) < 0) { \
152 heapsort_b(void *vbase, size_t nmemb, size_t size, heapsort_block compar) in heapsort_b() argument
155 heapsort(void *vbase, size_t nmemb, size_t size, in heapsort_b()
163 if (nmemb <= 1) in heapsort_b()
180 for (l = nmemb / 2 + 1; --l;) in heapsort_b()
[all …]
H A Dbsearch.c69 (bsearch_b)(const void *key, const void *base0, size_t nmemb, size_t size,
73 (bsearch_s)(const void *key, const void *base0, rsize_t nmemb, rsize_t size,
77 (bsearch)(const void *key, const void *base0, size_t nmemb, size_t size,
87 if (nmemb > RSIZE_MAX) {
95 } else if (nmemb != 0) {
112 for (lim = nmemb; lim != 0; lim >>= 1) {
/freebsd/contrib/llvm-project/compiler-rt/lib/asan/
H A Dasan_malloc_win_thunk.cpp29 __declspec(dllimport) void *__cdecl __asan_calloc(const size_t nmemb,
34 const size_t nmemb,
76 STATIC_MALLOC_INTERFACE void *calloc(const size_t nmemb, const size_t size) { in calloc() argument
77 return __asan_calloc(nmemb, size); in calloc()
80 STATIC_MALLOC_INTERFACE void *_calloc_base(const size_t nmemb, in _calloc_base() argument
82 return __asan_calloc(nmemb, size); in _calloc_base()
85 STATIC_MALLOC_INTERFACE void *_calloc_impl(const size_t nmemb, in _calloc_impl() argument
91 return __asan_calloc(nmemb, size); in _calloc_impl()
94 STATIC_MALLOC_INTERFACE void *_calloc_dbg(const size_t nmemb, const size_t size, in _calloc_dbg() argument
96 return __asan_calloc(nmemb, size); in _calloc_dbg()
[all …]
/freebsd/crypto/openssh/
H A Dxmalloc.c45 xcalloc(size_t nmemb, size_t size) in xcalloc() argument
49 if (size == 0 || nmemb == 0) in xcalloc()
51 if (SIZE_MAX / nmemb < size) in xcalloc()
53 ptr = calloc(nmemb, size); in xcalloc()
56 size * nmemb); in xcalloc()
61 xreallocarray(void *ptr, size_t nmemb, size_t size) in xreallocarray() argument
65 new_ptr = reallocarray(ptr, nmemb, size); in xreallocarray()
68 nmemb, size); in xreallocarray()
73 xrecallocarray(void *ptr, size_t onmemb, size_t nmemb, size_t size) in xrecallocarray() argument
77 new_ptr = recallocarray(ptr, onmemb, nmemb, size); in xrecallocarray()
[all …]
/freebsd/contrib/pam-krb5/portable/
H A Dreallocarray.c50 reallocarray(void *ptr, size_t nmemb, size_t size) in reallocarray() argument
52 if (nmemb >= CHECK_THRESHOLD || size >= CHECK_THRESHOLD) in reallocarray()
53 if (nmemb > 0 && SIZE_MAX / nmemb <= size) { in reallocarray()
59 if (nmemb == 0 || size == 0) { in reallocarray()
60 nmemb = 1; in reallocarray()
63 return realloc(ptr, nmemb * size); in reallocarray()
/freebsd/contrib/pkgconf/fuzzer/
H A Dalloc-inject.c31 void *__real_calloc(size_t nmemb, size_t size);
33 void *__real_reallocarray(void *ptr, size_t nmemb, size_t size);
38 void *__wrap_calloc(size_t nmemb, size_t size);
40 void *__wrap_reallocarray(void *ptr, size_t nmemb, size_t size);
88 __wrap_calloc(size_t nmemb, size_t size) in __wrap_calloc() argument
93 return __real_calloc(nmemb, size); in __wrap_calloc()
106 __wrap_reallocarray(void *ptr, size_t nmemb, size_t size) in __wrap_reallocarray() argument
111 return __real_reallocarray(ptr, nmemb, size); in __wrap_reallocarray()
/freebsd/usr.bin/diff/
H A Dxmalloc.c39 xcalloc(size_t nmemb, size_t size) in xcalloc() argument
43 ptr = calloc(nmemb, size); in xcalloc()
45 err(2, "xcalloc: allocating %zu * %zu bytes", nmemb, size); in xcalloc()
50 xreallocarray(void *ptr, size_t nmemb, size_t size) in xreallocarray() argument
54 new_ptr = reallocarray(ptr, nmemb, size); in xreallocarray()
57 nmemb, size); in xreallocarray()
/freebsd/contrib/mandoc/
H A Dcompat_reallocarray.c32 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()
H A Ddba_write.c91 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/contrib/unbound/compat/
H A Dreallocarray.c34 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/crypto/openssh/openbsd-compat/
H A Dreallocarray.c35 reallocarray(void *optr, size_t nmemb, size_t size) in reallocarray() argument
37 if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && in reallocarray()
38 nmemb > 0 && SIZE_MAX / nmemb < size) { in reallocarray()
42 return realloc(optr, size * nmemb); in reallocarray()
H A Dbsd-malloc.c37 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()
/freebsd/contrib/ntp/sntp/libpkgver/
H A Dcolcomp.c102 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/contrib/ntp/libntp/
H A Demalloc.c88 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/include/
H A Dstdlib.h380 static inline void qsort_r(void *base, size_t nmemb, size_t size, in qsort_r() argument
382 __qsort_r_compat(base, nmemb, size, thunk, compar); in qsort_r()
426 #define bsearch(key, base, nmemb, size, compar) __qualsel((base), \ argument
427 (const void *)(bsearch)((key), (base), (nmemb), (size), (compar)), \
428 (bsearch)((key), (base), (nmemb), (size), (compar)))
430 #define bsearch_b(key, base, nmemb, size, compar) __qualsel((base), \ argument
431 (const void *)(bsearch_b)((key), (base), (nmemb), (size), (compar)), \
432 (bsearch_b)((key), (base), (nmemb), (size), (compar)))
435 #define bsearch_s(key, base, nmemb, size, compar, context) \ argument
437 (const void *)(bsearch_s)((key), (base), (nmemb), (size), \
[all …]
/freebsd/contrib/ntp/libntp/lib/isc/unix/
H A Dstdio.c64 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/sys/dev/drm2/
H A Ddrm_mem_util.h35 static __inline__ void *drm_calloc_large(size_t nmemb, size_t size) in drm_calloc_large() argument
38 return mallocarray(nmemb, size, DRM_MEM_DRIVER, M_NOWAIT | M_ZERO); in drm_calloc_large()
42 static __inline__ void *drm_malloc_ab(size_t nmemb, size_t size) in drm_malloc_ab() argument
45 return mallocarray(nmemb, size, DRM_MEM_DRIVER, M_NOWAIT); in drm_malloc_ab()
/freebsd/contrib/llvm-project/compiler-rt/lib/nsan/
H A Dnsan_malloc_linux.cpp36 INTERCEPTOR(void *, calloc, uptr nmemb, uptr size) { in INTERCEPTOR() argument
38 return DlsymAlloc::Callocate(nmemb, size); in INTERCEPTOR()
39 return nsan_calloc(nmemb, size); in INTERCEPTOR()
63 INTERCEPTOR(void *, reallocarray, void *ptr, uptr nmemb, uptr size) { in INTERCEPTOR() argument
64 return nsan_reallocarray(ptr, nmemb, size); in INTERCEPTOR()
H A Dnsan_allocator.cpp178 static void *NsanCalloc(uptr nmemb, uptr size) { in NsanCalloc() argument
179 if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { in NsanCalloc()
184 ReportCallocOverflow(nmemb, size, &stack); in NsanCalloc()
186 return NsanAllocate(nmemb * size, sizeof(u64), true); in NsanCalloc()
220 void *__nsan::nsan_calloc(uptr nmemb, uptr size) { in nsan_calloc() argument
221 return SetErrnoOnNull(NsanCalloc(nmemb, size)); in nsan_calloc()
234 void *__nsan::nsan_reallocarray(void *ptr, uptr nmemb, uptr size) { in nsan_reallocarray() argument
235 if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { in nsan_reallocarray()
241 ReportReallocArrayOverflow(nmemb, size, &stack); in nsan_reallocarray()
243 return nsan_realloc(ptr, nmemb * size); in nsan_reallocarray()
/freebsd/contrib/llvm-project/compiler-rt/lib/hwasan/
H A Dhwasan_allocation_functions.cpp120 void *__sanitizer_calloc(uptr nmemb, uptr size) { in __sanitizer_calloc() argument
122 return DlsymAlloc::Callocate(nmemb, size); in __sanitizer_calloc()
124 return hwasan_calloc(nmemb, size, &stack); in __sanitizer_calloc()
136 void *__sanitizer_reallocarray(void *ptr, uptr nmemb, uptr size) { in __sanitizer_reallocarray() argument
138 return hwasan_reallocarray(ptr, nmemb, size, &stack); in __sanitizer_reallocarray()
174 INTERCEPTOR_ALIAS(void *, calloc, SIZE_T nmemb, SIZE_T size);
176 INTERCEPTOR_ALIAS(void *, reallocarray, void *ptr, SIZE_T nmemb, SIZE_T size);
/freebsd/contrib/llvm-project/compiler-rt/lib/dfsan/
H A Ddfsan_allocator.cpp177 static void *DFsanCalloc(uptr nmemb, uptr size) { in DFsanCalloc() argument
178 if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { in DFsanCalloc()
182 ReportCallocOverflow(nmemb, size, &stack); in DFsanCalloc()
184 return DFsanAllocate(nmemb * size, sizeof(u64), true /*zeroise*/); in DFsanCalloc()
219 void *__dfsan::dfsan_calloc(uptr nmemb, uptr size) { in dfsan_calloc() argument
220 return SetErrnoOnNull(DFsanCalloc(nmemb, size)); in dfsan_calloc()
233 void *__dfsan::dfsan_reallocarray(void *ptr, uptr nmemb, uptr size) { in dfsan_reallocarray() argument
234 if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { in dfsan_reallocarray()
239 ReportReallocArrayOverflow(nmemb, size, &stack); in dfsan_reallocarray()
241 return dfsan_realloc(ptr, nmemb * size); in dfsan_reallocarray()
/freebsd/contrib/unbound/util/
H A Dalloc.c395 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()
491 void *unbound_stat_calloc_log(size_t nmemb, size_t size, const char* file, in unbound_stat_calloc_log() argument
495 (unsigned) nmemb, (unsigned)size); in unbound_stat_calloc_log()
496 return unbound_stat_calloc(nmemb, size); in unbound_stat_calloc_log()
523 void *unbound_stat_reallocarray_log(void *ptr, size_t nmemb, size_t size, in unbound_stat_reallocarray_log() argument
527 ptr, (unsigned)nmemb, (unsigned)size); in unbound_stat_reallocarray_log()
528 return unbound_stat_realloc(ptr, nmemb*size); in unbound_stat_reallocarray_log()
[all …]
/freebsd/contrib/llvm-project/compiler-rt/lib/lsan/
H A Dlsan_allocator.cpp115 static void *Calloc(uptr nmemb, uptr size, const StackTrace &stack) { in Calloc() argument
116 if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { in Calloc()
119 ReportCallocOverflow(nmemb, size, &stack); in Calloc()
121 size *= nmemb; in Calloc()
231 void *lsan_reallocarray(void *ptr, uptr nmemb, uptr size, in lsan_reallocarray() argument
233 if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { in lsan_reallocarray()
237 ReportReallocArrayOverflow(nmemb, size, &stack); in lsan_reallocarray()
239 return lsan_realloc(ptr, nmemb * size, stack); in lsan_reallocarray()
242 void *lsan_calloc(uptr nmemb, uptr size, const StackTrace &stack) { in lsan_calloc() argument
243 return SetErrnoOnNull(Calloc(nmemb, size, stack)); in lsan_calloc()
/freebsd/contrib/llvm-project/compiler-rt/lib/memprof/
H A Dmemprof_malloc_linux.cpp61 INTERCEPTOR(void *, calloc, uptr nmemb, uptr size) { in INTERCEPTOR() argument
63 return DlsymAlloc::Callocate(nmemb, size); in INTERCEPTOR()
66 return memprof_calloc(nmemb, size, &stack); in INTERCEPTOR()
78 INTERCEPTOR(void *, reallocarray, void *ptr, uptr nmemb, uptr size) { in INTERCEPTOR() argument
81 return memprof_reallocarray(ptr, nmemb, size, &stack); in INTERCEPTOR()
/freebsd/contrib/wpa/src/utils/
H A Dos.h297 static inline void * os_calloc(size_t nmemb, size_t size) in os_calloc() argument
299 if (size && nmemb > (~(size_t) 0) / size) in os_calloc()
301 return os_zalloc(nmemb * size); in os_calloc()
585 static inline void * os_realloc_array(void *ptr, size_t nmemb, size_t size) in os_realloc_array() argument
587 if (size && nmemb > (~(size_t) 0) / size) in os_realloc_array()
589 return os_realloc(ptr, nmemb * size); in os_realloc_array()
599 static inline void os_remove_in_array(void *ptr, size_t nmemb, size_t size, in os_remove_in_array() argument
602 if (idx < nmemb - 1) in os_remove_in_array()
605 (nmemb - idx - 1) * size); in os_remove_in_array()

1234