xpcom/glue/nsQuickSort.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xpcom/glue/nsQuickSort.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,40 @@
     1.4 +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +
    1.10 +/* We need this because Solaris' version of qsort is broken and
    1.11 + * causes array bounds reads.
    1.12 + */
    1.13 +
    1.14 +#ifndef nsQuickSort_h___
    1.15 +#define nsQuickSort_h___
    1.16 +
    1.17 +#include "nscore.h"
    1.18 +
    1.19 +#ifdef __cplusplus
    1.20 +extern "C" {
    1.21 +#endif
    1.22 +
    1.23 +/**
    1.24 + * Parameters:
    1.25 + *  1. the array to sort
    1.26 + *  2. the number of elements in the array
    1.27 + *  3. the size of each array element
    1.28 + *  4. comparison function taking two elements and parameter #5 and
    1.29 + *     returning an integer:
    1.30 + *      + less than zero if the first element should be before the second
    1.31 + *      + 0 if the order of the elements does not matter
    1.32 + *      + greater than zero if the second element should be before the first
    1.33 + *  5. extra data to pass to comparison function
    1.34 + */
    1.35 +NS_COM_GLUE void NS_QuickSort(void *, unsigned int, unsigned int,
    1.36 +                              int (*)(const void *, const void *, void *), 
    1.37 +                              void *);
    1.38 +
    1.39 +#ifdef __cplusplus
    1.40 +}
    1.41 +#endif
    1.42 +
    1.43 +#endif /* nsQuickSort_h___ */

mercurial