Use qsort_s() from C11 Annex K to make string_list_sort() safer, in
particular when called from parallel threads.

Changes from v1:
* Renamed HAVE_QSORT_S to HAVE_ISO_QSORT_S in Makefile to disambiguate.
* Added basic perf test (patch 3).
* Converted a second caller to QSORT_S, in ref-filter.c (patch 5).

  compat: add qsort_s()
  add QSORT_S
  perf: add basic sort performance test
  string-list: use QSORT_S in string_list_sort()
  ref-filter: use QSORT_S in ref_array_sort()

 Makefile                    |  8 ++++++
 compat/qsort_s.c            | 69 +++++++++++++++++++++++++++++++++++++++++++++
 git-compat-util.h           | 11 ++++++++
 ref-filter.c                |  6 ++--
 string-list.c               | 13 ++++-----
 t/helper/test-string-list.c | 25 ++++++++++++++++
 t/perf/p0071-sort.sh        | 26 +++++++++++++++++
 7 files changed, 146 insertions(+), 12 deletions(-)
 create mode 100644 compat/qsort_s.c
 create mode 100755 t/perf/p0071-sort.sh

-- 
2.11.0

Reply via email to