Skip to content

Commit 0b654d9

Browse files
committed
MT#55283 add rtpe_g_tree_first shortcut
Change-Id: I71ab7965c9edf988dc501673cdb714a7bb8b5725
1 parent 75884b8 commit 0b654d9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/auxlib.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,12 @@ INLINE void *rtpe_g_tree_find_first(GTree *t, GEqualFunc f, void *data) {
432432
return h.out_p;
433433
}
434434
INLINE void *rtpe_g_tree_first(GTree *t) {
435+
#if GLIB_CHECK_VERSION(2,68,0)
436+
GTreeNode *n = g_tree_node_first(t);
437+
return n ? g_tree_node_value(n) : NULL;
438+
#else
435439
return rtpe_g_tree_find_first(t, NULL, NULL);
440+
#endif
436441
}
437442
INLINE void rtpe_g_tree_find_all(GQueue *out, GTree *t, GEqualFunc f, void *data) {
438443
struct rtpe_g_tree_find_helper h = {

0 commit comments

Comments
 (0)