gobject/gvaluearray.c · 2.84.1 · GNOME / GLib · GitLab (original) (raw)
Jun 28, 2024
b32e1b63
gqsort: Add g_sort_array() and deprecate g_qsort_with_data() · b32e1b63
Philip Withnall authored Jun 28, 2024
The latter only accepts agint
as the number of elements in the array,
which means that its use inGArray
(and related array implementations)
truncates at least half the potential array size.
So, introduce a replacement for it which usessize_t
for the number of
elements. This is inline with whatqsort()
(orqsort_r()
) actually
does. Unfortunately we can’t directly useqsort_r()
because it’s not
guaranteed to be a stable sort.
This fixes some-Wsign-conversion
warnings (when building GLib with
that enabled).
Signed-off-by:Philip Withnall <pwithnall@gnome.org>
Helps: #3405
b32e1b63
gqsort: Add g_sort_array() and deprecate g_qsort_with_data()
Philip Withnall authored Jun 28, 2024
The latter only accepts agint
as the number of elements in the array,
which means that its use inGArray
(and related array implementations)
truncates at least half the potential array size.
So, introduce a replacement for it which usessize_t
for the number of
elements. This is inline with whatqsort()
(orqsort_r()
) actually
does. Unfortunately we can’t directly useqsort_r()
because it’s not
guaranteed to be a stable sort.
This fixes some-Wsign-conversion
warnings (when building GLib with
that enabled).
Signed-off-by:Philip Withnall <pwithnall@gnome.org>
Helps: #3405
Loading