removed qsort_r() which seems unavailable on CygWin