IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Opened 22 years ago

Closed 22 years ago

Last modified 22 years ago

#89 closed defect (fixed)

psListSort compare function prototype (plus psSort questions)

Reported by: robert.desonia@… Owned by: eugene
Priority: high Milestone:
Component: PSLib SDRS Version: unspecified
Severity: normal Keywords:
Cc:

Description

I needed to change the compare function prototype from:

int compare(void*,void*)

to

int compare(void,void)

since a psList has void* data elements and to use qsort (as required by the
ADD), I needed to convert the list to a psVector of void* elements and call
qsort of that (hence, the qsort compare function needed pointers to void*, i.e.,
void).

Also, the psSort function does not take a compare function, but maybe should to
make things match.

I've created a set of generic compare functions along with the psListSort to
handle sorting of numeric types. These could be used for psSort as well (which
may be better called psVectorSort?).

Change History (1)

comment:1 by eugene, 22 years ago

Resolution: fixed
Status: newclosed

if we re-organize, as i specified in bug 75, to have psArray be our container of
void * elements and psVector only a numerical array, then:

  • you'll need to adjust psListSort to convert to a psArray (psListToVector

should become psListToArray anyway).

  • psSort as applied to a vector is always numeric, so do we need a separate

compare function?

  • we'll need to have a matching psArraySort with a compare parallel to psListSort

I agree with the name changes: psSort -> psVectorSort (but also psArraySort)

Note: See TracTickets for help on using tickets.