On December 17, 2002 04:59 am, Alberto Massari wrote:
It's just a matter of deciding what is best from a maintenance point of view: grouping the working code or grouping the functions.
I would say grouping the working code is preferable (second patch you sent) as the ugliness does not interfere with one's reading of the code.
There are valid arguments in favour of both styles, and I have no strong feelings, so I will submit the new patch shortly. In any case... what is the policy in this case?
In general we don't go for either method, but rather we test for the feature in port.h, and if absent we have our own implementation in port.c. But it doesn't work well in this case.
From my point of view, your second patch is better than the first.
Another way of doing it is stubbing the *context functions like so:
#ifndef HAVE_U_CONTEXT typedef struct ucontext { } ucontext_t;
int getcontext (ucontext_t *ucp) { return -1; }
int setcontext (const ucontext_t *ucp) { return -1; }
int swapcontext (ucontext_t *oucp, ucontext_t *ucp) { return -1; }
void makecontext(ucontext_t *ucp, void *func(), int argc, ...) { return -1; } #endif