22 #if defined(_WIN32) || defined(__WIN32)
23 #include <mm_malloc.h>
30 void *ptrmem = malloc(sz);
33 uintmax_t scmalloc_size_ = (uintmax_t)sz;
35 "to allocate %"PRIuMAX
" bytes", strerror(errno), scmalloc_size_);
44 void *ptrmem = realloc(ptr,
size);
48 "to allocate %"PRIuMAX
" bytes", strerror(errno), (uintmax_t)
size);
57 void *ptrmem = calloc(nm, sz);
61 "to allocate %"PRIuMAX
" bytes", strerror(errno), (uintmax_t)nm*sz);
70 char *ptrmem = strdup(s);
73 size_t _scstrdup_len = strlen(s);
75 "to allocate %"PRIuMAX
" bytes", strerror(errno), (uintmax_t)_scstrdup_len);
85 char *ptrmem = strndup(s, n);
87 const size_t sz = n + 1;
88 char *ptrmem = (
char *)malloc(sz);
89 if (
likely(ptrmem != NULL)) {
96 "to allocate %"PRIuMAX
" bytes", strerror(errno), (uintmax_t)(n + 1));
105 #if defined(__WIN32) || defined(_WIN32)
106 void *ptrmem = _mm_malloc(
size, align);
110 "to allocate %"PRIuMAX
" bytes, alignment %"PRIuMAX, strerror(errno), (uintmax_t)
size, (uintmax_t)align);
116 int r = posix_memalign(&ptrmem, align,
size);
117 if (
unlikely(r != 0 || ptrmem == NULL)) {
118 if (ptrmem != NULL) {
124 "to allocate %"PRIuMAX
" bytes, alignment %"PRIuMAX, strerror(errno), (uintmax_t)
size, (uintmax_t)align);
134 #if defined(__WIN32) || defined(_WIN32)