tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: qsort_r



On Sun, Dec 08, 2013 at 10:29:53PM +0000, David Holland wrote:
> 
> I have done it by having the original, non-_r functions provide a
> thunk for the comparison function, as this is least invasive. If we
> think this is too expensive, an alternative is generating a union of
> function pointers and making tests at the call sites; another option
> is to duplicate the code (hopefully with cpp rather than C&P) but that
> seems like a bad plan. Note that the thunks use an extra struct to
> hold the function pointer; this is to satisfy C standards pedantry
> about void pointers vs. function pointers, and if we decide not to
> care it could be simplified.

On most architectures I think just:
__weak_alias(heapsort_r,heapsort)                                           
__weak_alias(heapsort_r,_heapsort)                                           
will work.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index