summaryrefslogtreecommitdiff
path: root/compat/qsort.c
diff options
context:
space:
mode:
authorLibravatar René Scharfe <l.s.r@web.de>2017-01-22 18:51:11 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-01-23 11:02:34 -0800
commit04ee8b875b96c096c479132adca02fa734c3fa96 (patch)
treec9a761273a585248192544fd8dca35d0e678aada /compat/qsort.c
parentAlmost ready for 2.11.1 (diff)
downloadtgif-04ee8b875b96c096c479132adca02fa734c3fa96.tar.xz
compat: add qsort_s()
The function qsort_s() was introduced with C11 Annex K; it provides the ability to pass a context pointer to the comparison function, supports the convention of using a NULL pointer for an empty array and performs a few safety checks. Add an implementation based on compat/qsort.c for platforms that lack a native standards-compliant qsort_s() (i.e. basically everyone). It doesn't perform the full range of possible checks: It uses size_t instead of rsize_t and doesn't check nmemb and size against RSIZE_MAX because we probably don't have the restricted size type defined. For the same reason it returns int instead of errno_t. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/qsort.c')
0 files changed, 0 insertions, 0 deletions