1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-21 12:05:57 +03:00
postgres/src/port/qsort.c
Thomas Munro f374f4d664 Use sort_template.h for qsort() and qsort_arg().
Reduce duplication by using the new template.

Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/CA%2BhUKGJ2-eaDqAum5bxhpMNhvuJmRDZxB_Tow0n-gse%2BHG0Yig%40mail.gmail.com
2021-03-03 17:02:32 +13:00

23 lines
409 B
C

/*
* qsort.c: standard quicksort algorithm
*/
#include "c.h"
#define ST_SORT pg_qsort
#define ST_ELEMENT_TYPE_VOID
#define ST_COMPARE_RUNTIME_POINTER
#define ST_SCOPE
#define ST_DECLARE
#define ST_DEFINE
#include "lib/sort_template.h"
/*
* qsort comparator wrapper for strcmp.
*/
int
pg_qsort_strcmp(const void *a, const void *b)
{
return strcmp(*(const char *const *) a, *(const char *const *) b);
}