Closed Bug 72196 Opened 23 years ago Closed 15 years ago

eliminate |NS_QuickSort|, use C's standard |qsort| instead

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: mkaply, Unassigned)

References

Details

Attachments

(1 file)

NS_QuickSort is currently implemented in xpcom/ds.

I don't think this is the right place for it.

Here is my best explanation of logic for this.

NS_QuickSort requires that a function be passed into it. This function needs a 
calling convention set. The only two places in Mozilla where we really have the 
ability to specify calling conventions are NSPR and JS.

Currently, NS_QuickSort uses PR_EXTERN, but this is not correct, as there is no 
guarantee that NSPR and XPCOM will be compiled using the same calling 
convention. NSPR could even be compiled with a different compiler. so 
NS_QuickSort should either have its own calling convention created like 
NS_QS_EXTERN and NS_QS_CALLBACK, or it should be moved.

So NS_QuickSort needs to be in a place that allows calling convention to be set 
on the compilation of it, as well as the header and calling of it.

My personal suggestion would be NSPR, and I am attaching a diff for that.
i'd recommend waiting until after NS_QuickSort drops off the topcrash reports 
:-(
Depends on: 80643
Mozilla should consider removing NS_QuickSort and just use
qsort in the standard C library.  The comments in the source
file:
    /* We need this because Solaris' version of qsort is broken and
     * causes array bounds reads.
     */
turned out to be wrong -- we were calling qsort with an
incorrect comparison function which only broke the Solaris
implementation of qsort.
Summary: NS_QuickSort does not really belong in XPCOM → eliminate |NS_QuickSort|, use C's standard |qsort| instead
Should we look at creating a patch for this?
qsort doesn't provide a transparent |void* data| parameter that gets passed on
to the compare-function. At least transformiix uses this, possibly others too.
QA Contact: kandrot → nobody
Assignee: scc → nobody
QA Contact: nobody → xpcom
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WONTFIX
See Also: → 1141431
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: