xpcom/glue/nsQuickSort.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 /* We need this because Solaris' version of qsort is broken and
     8  * causes array bounds reads.
     9  */
    11 #ifndef nsQuickSort_h___
    12 #define nsQuickSort_h___
    14 #include "nscore.h"
    16 #ifdef __cplusplus
    17 extern "C" {
    18 #endif
    20 /**
    21  * Parameters:
    22  *  1. the array to sort
    23  *  2. the number of elements in the array
    24  *  3. the size of each array element
    25  *  4. comparison function taking two elements and parameter #5 and
    26  *     returning an integer:
    27  *      + less than zero if the first element should be before the second
    28  *      + 0 if the order of the elements does not matter
    29  *      + greater than zero if the second element should be before the first
    30  *  5. extra data to pass to comparison function
    31  */
    32 NS_COM_GLUE void NS_QuickSort(void *, unsigned int, unsigned int,
    33                               int (*)(const void *, const void *, void *), 
    34                               void *);
    36 #ifdef __cplusplus
    37 }
    38 #endif
    40 #endif /* nsQuickSort_h___ */

mercurial