ruby-changes:70142
From: Nobuyoshi <ko1@a...>
Date: Fri, 10 Dec 2021 18:40:26 +0900 (JST)
Subject: [ruby-changes:70142] a5baf8d6bc (master): Revert zero-check for alloca
https://git.ruby-lang.org/ruby.git/commit/?id=a5baf8d6bc From a5baf8d6bc4c21259705f9b4f9aa2d9b9d7ab936 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Fri, 10 Dec 2021 18:33:17 +0900 Subject: Revert zero-check for alloca Something weird results in int-in-bool-context and stringop-overflow warnings. --- include/ruby/internal/memory.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/ruby/internal/memory.h b/include/ruby/internal/memory.h index 242892d50f0..aa3464465da 100644 --- a/include/ruby/internal/memory.h +++ b/include/ruby/internal/memory.h @@ -284,7 +284,7 @@ typedef uint128_t DSIZE_T; https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/memory.h#L284 * @return A pointer on stack. */ #define ALLOCA_N(type,n) \ - RBIMPL_CAST((type *)(!(n) ? NULL : alloca(rbimpl_size_mul_or_raise(sizeof(type), (n))))) + RBIMPL_CAST((type *)alloca(rbimpl_size_mul_or_raise(sizeof(type), (n)))) /** * Identical to #RB_ALLOCV_N(), except it implicitly assumes the type of array @@ -297,7 +297,7 @@ typedef uint128_t DSIZE_T; https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/memory.h#L297 */ #define RB_ALLOCV(v, n) \ ((n) < RUBY_ALLOCV_LIMIT ? \ - ((v) = 0, !(n) ? NULL : alloca(n)) : \ + ((v) = 0, alloca(n)) : \ rb_alloc_tmp_buffer(&(v), (n))) /** @@ -330,7 +330,7 @@ typedef uint128_t DSIZE_T; https://github.com/ruby/ruby/blob/trunk/include/ruby/internal/memory.h#L330 #define RB_ALLOCV_N(type, v, n) \ RBIMPL_CAST((type *) \ (((size_t)(n) < RUBY_ALLOCV_LIMIT / sizeof(type)) ? \ - ((v) = 0, !(n) ? NULL : alloca((n) * sizeof(type))) : \ + ((v) = 0, alloca((n) * sizeof(type))) : \ rb_alloc_tmp_buffer2(&(v), (n), sizeof(type)))) /** -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/