Graphviz 13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
sort.h File Reference

qsort with carried along context More...

#include <assert.h>
#include <stdlib.h>
Include dependency graph for sort.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TLS   /* nothing */
 thread-local storage specifier
 

Functions

static int gv_sort_compar_wrapper (const void *a, const void *b)
 
static void gv_sort (void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *, void *), void *arg)
 qsort with an extra state parameter, ala qsort_r
 

Variables

static TLS int(* gv_sort_compar )(const void *, const void *, void *)
 
static TLS void * gv_sort_arg
 

Detailed Description

The non-standard qsort_r, Windows’ qsort_s, and C11’s qsort_s provide a qsort alternative with an extra state parameter. Unfortunately none of these are easily usable portably in Graphviz. This header implements an alternative that hopefully is.

Definition in file sort.h.

Macro Definition Documentation

◆ TLS

#define TLS   /* nothing */

Definition at line 23 of file sort.h.

Function Documentation

◆ gv_sort()

static void gv_sort ( void *  base,
size_t  nmemb,
size_t  size,
int(*)(const void *, const void *, void *)  compar,
void *  arg 
)
inlinestatic

Definition at line 35 of file sort.h.

References gv_sort_arg, gv_sort_compar, gv_sort_compar_wrapper(), and NULL.

Referenced by arrayRects(), find_closest_pairs(), quicksort_place(), quicksort_place(), and quicksort_placef().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gv_sort_compar_wrapper()

static int gv_sort_compar_wrapper ( const void *  a,
const void *  b 
)
inlinestatic

Definition at line 29 of file sort.h.

References gv_sort_arg, gv_sort_compar, and NULL.

Referenced by gv_sort().

Here is the caller graph for this function:

Variable Documentation

◆ gv_sort_arg

TLS void* gv_sort_arg
static

Definition at line 27 of file sort.h.

Referenced by gv_sort(), and gv_sort_compar_wrapper().

◆ gv_sort_compar

TLS int(* gv_sort_compar) (const void *, const void *, void *) ( const void *  ,
const void *  ,
void *   
)
static

Definition at line 26 of file sort.h.

Referenced by gv_sort(), and gv_sort_compar_wrapper().