Commit 0a1c3190 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Add pango_tab_array_sort

A utility function to ensure tab stops are in
increasing order.
parent 7b8d9efa
......@@ -576,3 +576,28 @@ pango_tab_array_get_decimal_point (PangoTabArray *tab_array,
return tab_array->tabs[tab_index].decimal_point;
static int
compare_tabs (const void *p1, const void *p2)
const PangoTab *t1 = p1;
const PangoTab *t2 = p2;
return t1->location - t2->location;
* pango_tab_array_sort:
* @tab_array: a `PangoTabArray`
* Utility function to ensure that the tab stops are in increasing order.
* Since: 1.50
pango_tab_array_sort (PangoTabArray *tab_array)
g_return_if_fail (tab_array != NULL);
qsort (tab_array->tabs, tab_array->size, sizeof (PangoTab), compare_tabs);
......@@ -106,6 +106,9 @@ PANGO_AVAILABLE_IN_1_50
gunichar pango_tab_array_get_decimal_point (PangoTabArray *tab_array,
int tab_index);
void pango_tab_array_sort (PangoTabArray *tab_array);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoTabArray, pango_tab_array_free)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment