This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH,RFA] Ensure check_may_shrink_heap always returns the final value
- From: Roland McGrath <roland at hack dot frob dot com>
- To: Alexandre Oliva <aoliva at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 13 Jan 2015 12:49:31 -0800 (PST)
- Subject: Re: [PATCH,RFA] Ensure check_may_shrink_heap always returns the final value
- Authentication-results: sourceware.org; auth=none
- References: <or1u4n5aig dot fsf at livre dot home> <or4mt4ya7x dot fsf at free dot home>
The substance of the change is OK. But I don't like the variable
names. Using "global" in the name of something that is not in global
scope looks odd (I realize you intended a different sense of "global",
but still). Also, while you're there you can replace __builtin_expect
with __glibc_likely.
I'm inclined to say the cleanest thing would be to factor out the
nontrivial code into a subroutine, so you can just write:
if (__glibc_unlikely (may_shrink_heap < 0))
may_shrink_heap = __libc_enable_secure || overcommit_disabled ();
return may_shrink_heap;
Thanks,
Roland