|
From: | Richard Henderson |
Subject: | Re: [Qemu-devel] [PATCH V6 1/6] oslib-posix: add helpers for stack alloc and free |
Date: | Mon, 22 Aug 2016 08:19:06 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
On 08/22/2016 06:04 AM, Peter Lieven wrote:
+static size_t adjust_stack_size(size_t sz) +{ +#ifdef _SC_THREAD_STACK_MIN + /* avoid stacks smaller than _SC_THREAD_STACK_MIN */ + sz = MAX(MAX(sysconf(_SC_THREAD_STACK_MIN), 0), sz); +#endif
You need to place the sysconf result into a local variable. What you have now expands to 4 invocations of the function.
You might also consider passing in the pagesize, since you've already called getpagesize in one of the two users of this function.
r~
[Prev in Thread] | Current Thread | [Next in Thread] |