Re: [PATCH] Add compat/setenv.c, use in git.c.
- From
- Morten Welinder <mwelinder@gmail.com>
- Date
- Dec 6, 2005, 21:10 UTC
- Message-ID
- <118833cc0512061310r6398f812ia47a84d3cfad1564@mail.gmail.com>
- In-Reply-To
- <14331.1133899163@lotus.CS.Berkeley.EDU>
The code looks wrong. It assumes that pointers are no larger than ints. If pointers are larger than ints, the code does not necessarily compute a consistent ordering and qsort is allowed to do whatever it wants.
Morten
static int compare_object_pointers(const void *a, const void *b)
{
const struct object * const *pa = a;
const struct object * const *pb = b;
return *pa - *pb;
}