GNU Compatibility: Implement qsort_r
This is a version of the qsort function allowing you to pass a "cookie" to the function. Change-Id: I60c645213b9c9590e38b112634fcac1d7969b6d9 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2449 Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
1c889d23fe
commit
5c32512076
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2020 Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Isaac Turner, [email protected]
|
||||
* Jacob Secunda, [email protected]
|
||||
*/
|
||||
#ifndef _GNU_STDLIB_H_
|
||||
#define _GNU_STDLIB_H_
|
||||
|
||||
|
||||
#include_next <stdlib.h>
|
||||
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef int (*_compare_function_qsort_r)(const void*, const void*, void*);
|
||||
|
||||
extern void qsort_r(void* base, size_t numElements, size_t sizeOfElement,
|
||||
_compare_function_qsort_r, void* cookie);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _GNU_SOURCE */
|
||||
|
||||
|
||||
#endif /* _GNU_STDLIB_H_ */
|
||||
Reference in New Issue
Block a user