Search code examples
compilationglib

GLib: Replacement for deprecated g_tree_traverse() function?


recently we planned to upgrade glib library to latest version : 2.64

We have built the library and try to use the same in our build infrastructure. While running build we are failing lot of warnings with symbol 'g_tree_travers' as follows :-

warning: 'g_tree_traverse' is deprecated [-Wdeprecated-declarations]

Not sure what we supposed to use instead of g_tree_traverse, How could we fix the issue?


Solution

  • Copying from the documentation (as suggested by Jussi):

    g_tree_traverse has been deprecated since version 2.2 and should not be used in newly-written code.

    The order of a balanced tree is somewhat arbitrary. If you just want to visit all nodes in sorted order, use g_tree_foreach() instead. If you really need to visit nodes in a different order, consider using an n-ary tree.