summaryrefslogtreecommitdiff
path: root/include/ruby/internal/memory.h
diff options
context:
space:
mode:
authorMike Dalessio <[email protected]>2024-05-24 13:10:10 -0400
committerJean Boussier <[email protected]>2024-05-28 07:33:07 +0200
commit1b8ba1551b26fac906998e34fd2af3f82b433469 (patch)
tree1f26aba3e5ac361be214151b3ab489755d7cebb8 /include/ruby/internal/memory.h
parent9e9f1d9301b05604d475573ddd18d6bf5185466c (diff)
Allow compilation of C extensions with `-Wconversion`
C extension maintainers can now compile with this warning option and the Ruby header files will generate no warnings. [Feature #20507]
Diffstat (limited to 'include/ruby/internal/memory.h')
-rw-r--r--include/ruby/internal/memory.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/ruby/internal/memory.h b/include/ruby/internal/memory.h
index 270cc1ac8b..64e850c65e 100644
--- a/include/ruby/internal/memory.h
+++ b/include/ruby/internal/memory.h
@@ -643,7 +643,7 @@ rbimpl_size_mul_or_raise(size_t x, size_t y)
static inline void *
rb_alloc_tmp_buffer2(volatile VALUE *store, long count, size_t elsize)
{
- const size_t total_size = rbimpl_size_mul_or_raise(count, elsize);
+ const size_t total_size = rbimpl_size_mul_or_raise(RBIMPL_CAST((size_t)count), elsize);
const size_t cnt = (total_size + sizeof(VALUE) - 1) / sizeof(VALUE);
return rb_alloc_tmp_buffer_with_count(store, total_size, cnt);
}