xref: /llvm-project/libc/src/stdlib/qsort_r.h (revision 33bdb53d864e3e244d8fd5649062f17b7d4c958d)
1d3074f16SMichael Jones //===-- Implementation header for qsort_r -----------------------*- C++ -*-===//
2d3074f16SMichael Jones //
3d3074f16SMichael Jones // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4d3074f16SMichael Jones // See https://llvm.org/LICENSE.txt for license information.
5d3074f16SMichael Jones // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6d3074f16SMichael Jones //
7d3074f16SMichael Jones //===----------------------------------------------------------------------===//
8d3074f16SMichael Jones 
9d3074f16SMichael Jones #ifndef LLVM_LIBC_SRC_STDLIB_QSORT_R_H
10d3074f16SMichael Jones #define LLVM_LIBC_SRC_STDLIB_QSORT_R_H
11d3074f16SMichael Jones 
12*33bdb53dSJob Henandez Lara #include "hdr/types/size_t.h"
135ff3ff33SPetr Hosek #include "src/__support/macros/config.h"
14d3074f16SMichael Jones 
155ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL {
16d3074f16SMichael Jones 
17d3074f16SMichael Jones // This qsort_r uses the glibc argument ordering instead of the BSD argument
18d3074f16SMichael Jones // ordering (which puts arg before the function pointer). Putting arg after the
19d3074f16SMichael Jones // function pointer more closely matches the ordering for qsort_s, which is the
20d3074f16SMichael Jones // standardized equivalent of qsort_r.
21d3074f16SMichael Jones 
22d3074f16SMichael Jones void qsort_r(void *array, size_t array_size, size_t elem_size,
23d3074f16SMichael Jones              int (*compare)(const void *, const void *, void *), void *arg);
24d3074f16SMichael Jones 
255ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL
26d3074f16SMichael Jones 
27d3074f16SMichael Jones #endif // LLVM_LIBC_SRC_STDLIB_QSORT_R_H
28