You use 'foo' any way you want, typically it's a sort direction.
Skipping the issue of how concise this code is, for clarity's sake I'll
leave your code alone and treat foo as a Boolean which will reverse the
sort direction ->
>
> DmQuickSort(db, (DmComparF *) &SortRecords, 0);
>
> static Int16 SortRecords(DBRecordType * r1, DBRecordType * r2, Int16
> foo)
> {
-> Int16 result;
> if (r1->quantity == r2->quantity)
-> result = 0;
> else if (r1->quantity < r2->quantity)
-> result = -1;
> else
-> result = 1;
-> if (foo) result *= -1;
-> return result;
> }
>
> Thanks
>
> Julio
>
>
>
> --
> For information on using the Palm Developer Forums, or to
unsubscribe,
> please see http://www.palmos.com/dev/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/