gmessages: Add g_warning_once()

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");
This commit is contained in:
Jonas Ådahl
2019-08-08 09:37:48 +02:00
parent 35e26151a8
commit 15e3b6f136
3 changed files with 60 additions and 0 deletions

View File

@@ -1411,6 +1411,7 @@ g_log
g_logv
g_message
g_warning
g_warning_once
g_critical
g_error
g_info