Skip to content

gmessages: Add g_warning_once()

Jonas Ådahl requested to merge jadahl/glib:wip/g-warning-once into master

In many places the pattern

static gboolean warned_once = FALSE;
if (!warned_once)
  {
    g_warning ("This and that");
    warned_once = TRUE;
  }

is used to not spam the same warning message over and over again. Add a helper in glib for this, allowing the above statement to be changed to

g_warning_once ("This and that");
  • Tag with GLIB_AVAILABLE_IN_2_64 once available
Edited by Jonas Ådahl

Merge request reports