Home
last modified time | relevance | path

Searched refs:nmemb (Results 1 – 25 of 81) 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 Dreallocarray.c30 reallocarray(void *optr, size_t nmemb, size_t size) in reallocarray() argument
33 if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && in reallocarray()
34 nmemb > 0 && SIZE_MAX / nmemb < size) { in reallocarray()
38 return (realloc(optr, size * nmemb)); in reallocarray()
H A Dbsearch.c61 bsearch_b(const void *key, const void *base0, size_t nmemb, size_t size, in bsearch_b() argument
65 bsearch(const void *key, const void *base0, size_t nmemb, size_t size, in bsearch_b()
74 for (lim = nmemb; lim != 0; lim >>= 1) { in bsearch_b()
H A Dmerge.c107 mergesort_b(void *base, size_t nmemb, size_t size, cmp_t cmp) in mergesort_b() argument
109 mergesort(void *base, size_t nmemb, size_t size, cmp_t cmp) in mergesort_b()
123 if (nmemb == 0) in mergesort_b()
130 if ((list2 = malloc(nmemb * size + PSIZE)) == NULL) in mergesort_b()
134 setup(list1, list2, nmemb, size, cmp); in mergesort_b()
135 last = list2 + nmemb * size; in mergesort_b()
230 last = list2 + nmemb*size; in mergesort_b()
233 memmove(list2, list1, nmemb*size); in mergesort_b()
/freebsd/crypto/openssh/
H A Dxmalloc.c47 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/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.c37 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()
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/contrib/llvm-project/compiler-rt/lib/nsan/
H A Dnsan_malloc_linux.cpp37 INTERCEPTOR(void *, calloc, uptr nmemb, uptr size) { in INTERCEPTOR() argument
39 return DlsymAlloc::Callocate(nmemb, size); in INTERCEPTOR()
41 void *res = REAL(calloc)(nmemb, size); in INTERCEPTOR()
43 __nsan_set_value_unknown(static_cast<u8 *>(res), nmemb * size); in INTERCEPTOR()
74 INTERCEPTOR(void *, reallocarray, void *ptr, uptr nmemb, uptr size) { in INTERCEPTOR() argument
75 void *res = REAL(reallocarray)(ptr, nmemb, size); in INTERCEPTOR()
77 __nsan_set_value_unknown(static_cast<u8 *>(res), nmemb * size); in INTERCEPTOR()
/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/dfsan/
H A Ddfsan_allocator.cpp174 void *DFsanCalloc(uptr nmemb, uptr size) { in DFsanCalloc() argument
175 if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { in DFsanCalloc()
179 ReportCallocOverflow(nmemb, size, &stack); in DFsanCalloc()
181 return DFsanAllocate(nmemb * size, sizeof(u64), true /*zeroise*/); in DFsanCalloc()
216 void *dfsan_calloc(uptr nmemb, uptr size) { in dfsan_calloc() argument
217 return SetErrnoOnNull(DFsanCalloc(nmemb, size)); in dfsan_calloc()
230 void *dfsan_reallocarray(void *ptr, uptr nmemb, uptr size) { in dfsan_reallocarray() argument
231 if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { in dfsan_reallocarray()
236 ReportReallocArrayOverflow(nmemb, size, &stack); in dfsan_reallocarray()
238 return dfsan_realloc(ptr, nmemb * size); in dfsan_reallocarray()
/freebsd/contrib/llvm-project/compiler-rt/lib/hwasan/
H A Dhwasan_allocation_functions.cpp124 void *__sanitizer_calloc(uptr nmemb, uptr size) { in __sanitizer_calloc() argument
126 return DlsymAlloc::Callocate(nmemb, size); in __sanitizer_calloc()
128 return hwasan_calloc(nmemb, size, &stack); in __sanitizer_calloc()
140 void *__sanitizer_reallocarray(void *ptr, uptr nmemb, uptr size) { in __sanitizer_reallocarray() argument
142 return hwasan_reallocarray(ptr, nmemb, size, &stack); in __sanitizer_reallocarray()
178 INTERCEPTOR_ALIAS(void *, calloc, SIZE_T nmemb, SIZE_T size);
180 INTERCEPTOR_ALIAS(void *, reallocarray, void *ptr, SIZE_T nmemb, SIZE_T size);
/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/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/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()
227 void *lsan_reallocarray(void *ptr, uptr nmemb, uptr size, in lsan_reallocarray() argument
229 if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { in lsan_reallocarray()
233 ReportReallocArrayOverflow(nmemb, size, &stack); in lsan_reallocarray()
235 return lsan_realloc(ptr, nmemb * size, stack); in lsan_reallocarray()
238 void *lsan_calloc(uptr nmemb, uptr size, const StackTrace &stack) { in lsan_calloc() argument
239 return SetErrnoOnNull(Calloc(nmemb, size, stack)); in lsan_calloc()
/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()
/freebsd/lib/libc/tests/stdlib/
H A Dtest-sort.h51 ssort(int v[], int nmemb) in ssort() argument
55 for (i = 0; i < nmemb; i++) { in ssort()
56 for (j = i + 1; j < nmemb; j++) { in ssort()
/freebsd/contrib/llvm-project/compiler-rt/lib/msan/
H A Dmsan_allocator.cpp293 static void *MsanCalloc(BufferedStackTrace *stack, uptr nmemb, uptr size) { in MsanCalloc() argument
294 if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { in MsanCalloc()
298 ReportCallocOverflow(nmemb, size, stack); in MsanCalloc()
300 return MsanAllocate(stack, nmemb * size, sizeof(u64), true); in MsanCalloc()
334 void *msan_calloc(uptr nmemb, uptr size, BufferedStackTrace *stack) { in msan_calloc() argument
335 return SetErrnoOnNull(MsanCalloc(stack, nmemb, size)); in msan_calloc()
348 void *msan_reallocarray(void *ptr, uptr nmemb, uptr size, in msan_reallocarray() argument
350 if (UNLIKELY(CheckForCallocOverflow(size, nmemb))) { in msan_reallocarray()
355 ReportReallocArrayOverflow(nmemb, size, stack); in msan_reallocarray()
357 return msan_realloc(ptr, nmemb * size, stack); in msan_reallocarray()
/freebsd/sys/sys/
H A Dmalloc.h248 void *mallocarray(size_t nmemb, size_t size, struct malloc_type *type,
251 void *mallocarray_domainset(size_t nmemb, size_t size, struct malloc_type *type,
284 WOULD_OVERFLOW(size_t nmemb, size_t size) in WOULD_OVERFLOW()
287 return ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
288 nmemb > 0 && __SIZE_T_MAX / nmemb < size);
279 WOULD_OVERFLOW(size_t nmemb,size_t size) WOULD_OVERFLOW() argument

1234