diff options
Diffstat (limited to 'include/ruby/internal/memory.h')
| -rw-r--r-- | include/ruby/internal/memory.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/include/ruby/internal/memory.h b/include/ruby/internal/memory.h index 6884db195d..aa3464465d 100644 --- a/include/ruby/internal/memory.h +++ b/include/ruby/internal/memory.h @@ -287,12 +287,12 @@ typedef uint128_t DSIZE_T; RBIMPL_CAST((type *)alloca(rbimpl_size_mul_or_raise(sizeof(type), (n)))) /** - * Identical to #RB_ALLOCV_N(), except that it allocates a number of bytes and - * returns a void* . + * Identical to #RB_ALLOCV_N(), except it implicitly assumes the type of array + * is ::VALUE. * * @param v A variable to hold the just-in-case opaque Ruby object. * @param n Size of allocation, in bytes. - * @return A void pointer to `n` bytes storage. + * @return An array of `n` bytes of ::VALUE. * @note `n` may be evaluated twice. */ #define RB_ALLOCV(v, n) \ @@ -363,7 +363,7 @@ typedef uint128_t DSIZE_T; * @return `p1`. * @post First `n` elements of `p2` are copied into `p1`. */ -#define MEMCPY(p1,p2,type,n) ruby_nonempty_memcpy((p1), (p2), rbimpl_size_mul_or_raise(sizeof(type), (n))) +#define MEMCPY(p1,p2,type,n) memcpy((p1), (p2), rbimpl_size_mul_or_raise(sizeof(type), (n))) /** * Handy macro to call memmove. @@ -644,6 +644,7 @@ rb_alloc_tmp_buffer2(volatile VALUE *store, long count, size_t elsize) return rb_alloc_tmp_buffer_with_count(store, total_size, cnt); } +#if ! defined(__MINGW32__) && ! defined(__DOXYGEN__) RBIMPL_SYMBOL_EXPORT_BEGIN() RBIMPL_ATTR_NOALIAS() RBIMPL_ATTR_NONNULL((1)) @@ -662,5 +663,8 @@ ruby_nonempty_memcpy(void *dest, const void *src, size_t n) } } RBIMPL_SYMBOL_EXPORT_END() +#undef memcpy +#define memcpy ruby_nonempty_memcpy +#endif #endif /* RBIMPL_MEMORY_H */ |
