RFR: 8304836: Make MALLOC_MIN4 macro more robust [v2]

Naoto Sato naoto at openjdk.org
Fri Apr 21 16:22:03 UTC 2023


On Fri, 21 Apr 2023 12:42:24 GMT, David Schlosnagle <duke at openjdk.org> wrote:

>> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update src/java.base/share/native/libjava/jni_util.c
>>   
>>   Co-authored-by: David Schlosnagle <schlosna at gmail.com>
>
> src/java.base/share/native/libjava/jni_util.c line 42:
> 
>> 40:  * that overflows into negative value.
>> 41:  */
>> 42: #define MALLOC_MIN4(len) (len >= INT_MAX || len < 0 ? \
> 
> Should this keep the parentheses around `len` for explicit order of operations in case `len` is an expression?
> 
> Suggestion:
> 
> #define MALLOC_MIN4(len) ((len) >= INT_MAX || (len) < 0 ? \

Good point. Suggestion incorporated

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13564#discussion_r1173952865


More information about the core-libs-dev mailing list