RFR: JDK-8298170 : Introduce a macro for exception check, free and return
Matthias Baesken
mbaesken at openjdk.org
Wed Dec 7 08:45:01 UTC 2022
On Tue, 6 Dec 2022 20:40:34 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
> The existing code more obviously handles memory deallocation.
Thomas Stuefe suggested something like this
JNU_CHECK_EXCEPTION_DO(env, action)
JNU_CHECK_EXCEPTION_DO_AND_RETURN(env, action, retval)
usage example:
`JNU_CHECK_EXCEPTION_DO(env, { free(tab); })`
This would make the free-ing more clear, and should also work for 2 free-calls, we a have places like this in the codebase. What do you think about this?
-------------
PR: https://git.openjdk.org/jdk/pull/11539
More information about the core-libs-dev
mailing list