BRL-CAD
sort.h
Go to the documentation of this file.
1 /* S O R T . H
2  * BRL-CAD
3  *
4  * Copyright (c) 2004-2024 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 
21 #ifndef BU_SORT_H
22 #define BU_SORT_H
23 
24 #include "common.h"
25 
26 #include <stddef.h> /* for size_t */
27 
28 #include "bu/defines.h"
29 
30 __BEGIN_DECLS
31 
32 /** @addtogroup bu_sort
33  *
34  * @brief
35  * Platform-independent re-entrant version of qsort.
36  *
37  * The first argument is the array to sort, the second the number of elements
38  * inside the array, the third the size of one element, the fourth the
39  * comparison-function and the fifth a variable which is handed as a third
40  * argument to the comparison-function.
41  *
42  */
43 /** @{ */
44 /** @file bu/sort.h */
45 
46 BU_EXPORT extern void bu_sort(void *array, size_t nummemb, size_t sizememb,
47  int (*compare)(const void *, const void *, void *), void *context);
48 
49 
50 /** @} */
51 
52 __END_DECLS
53 
54 #endif /* BU_SORT_H */
55 
56 /*
57  * Local Variables:
58  * mode: C
59  * tab-width: 8
60  * indent-tabs-mode: t
61  * c-file-style: "stroustrup"
62  * End:
63  * ex: shiftwidth=4 tabstop=8
64  */
Header file for the BRL-CAD common definitions.
void bu_sort(void *array, size_t nummemb, size_t sizememb, int(*compare)(const void *, const void *, void *), void *context)