[glib] Use G_DEFINE_QUARK for GLib's own quarks



commit 4f12f7c029d8a4e7eaca633cb7e71c82a08be28d
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Aug 27 23:36:42 2012 -0400

    Use G_DEFINE_QUARK for GLib's own quarks
    
    This commit just deals with glib/.
    gobject/ and gio/ will be handled in separate commits.

 glib/gbookmarkfile.c   |   10 +---------
 glib/gconvert.c        |    6 +-----
 glib/gfileutils.c      |    6 +-----
 glib/giochannel.c      |    7 ++-----
 glib/gkeyfile.c        |    7 +------
 glib/glib-unix.c       |    6 +-----
 glib/gmarkup.c         |    6 +-----
 glib/goption.c         |    7 +------
 glib/gregex.c          |   11 +----------
 glib/gshell.c          |    6 +-----
 glib/gspawn-win32.c    |   13 ++-----------
 glib/gspawn.c          |   13 ++-----------
 glib/gthread.c         |    6 +-----
 glib/gvariant-parser.c |   11 +----------
 14 files changed, 17 insertions(+), 98 deletions(-)
---
diff --git a/glib/gbookmarkfile.c b/glib/gbookmarkfile.c
index f8c2756..28eba21 100644
--- a/glib/gbookmarkfile.c
+++ b/glib/gbookmarkfile.c
@@ -1585,15 +1585,7 @@ timestamp_from_iso8601 (const gchar *iso_date)
   return (time_t) stamp.tv_sec;
 }
 
-
-
-GQuark
-g_bookmark_file_error_quark (void)
-{
-  return g_quark_from_static_string ("g-bookmark-file-error-quark");
-}
-
-
+G_DEFINE_QUARK ("g-bookmark-file-error-quark", g_bookmark_file_error)
 
 /********************
  *    Public API    *
diff --git a/glib/gconvert.c b/glib/gconvert.c
index dded367..9f3bae3 100644
--- a/glib/gconvert.c
+++ b/glib/gconvert.c
@@ -194,11 +194,7 @@
  */
 #define NUL_TERMINATOR_LENGTH 4
 
-GQuark 
-g_convert_error_quark (void)
-{
-  return g_quark_from_static_string ("g_convert_error");
-}
+G_DEFINE_QUARK ("g_convert_error", g_convert_error)
 
 static gboolean
 try_conversion (const char *to_codeset,
diff --git a/glib/gfileutils.c b/glib/gfileutils.c
index 0df9305..0ac295c 100644
--- a/glib/gfileutils.c
+++ b/glib/gfileutils.c
@@ -459,11 +459,7 @@ g_file_test (const gchar *filename,
 #endif
 }
 
-GQuark
-g_file_error_quark (void)
-{
-  return g_quark_from_static_string ("g-file-error-quark");
-}
+G_DEFINE_QUARK ("g-file-error-quark", g_file_error)
 
 /**
  * g_file_error_from_errno:
diff --git a/glib/giochannel.c b/glib/giochannel.c
index 32099f7..8d19308 100644
--- a/glib/giochannel.c
+++ b/glib/giochannel.c
@@ -2580,8 +2580,5 @@ g_io_channel_write_unichar (GIOChannel  *channel,
  *
  * Error codes returned by #GIOChannel operations.
  **/
-GQuark
-g_io_channel_error_quark (void)
-{
-  return g_quark_from_static_string ("g-io-channel-error-quark");
-}
+
+G_DEFINE_QUARK ("g-io-channel-error-quark", g_io_channel_error)
diff --git a/glib/gkeyfile.c b/glib/gkeyfile.c
index 6e8dfa1..161370f 100644
--- a/glib/gkeyfile.c
+++ b/glib/gkeyfile.c
@@ -554,12 +554,7 @@ static void                  g_key_file_parse_data             (GKeyFile
 static void                  g_key_file_flush_parse_buffer     (GKeyFile               *key_file,
 								GError                **error);
 
-
-GQuark
-g_key_file_error_quark (void)
-{
-  return g_quark_from_static_string ("g-key-file-error-quark");
-}
+G_DEFINE_QUARK ("g-key-file-error-quark", g_key_file_error)
 
 static void
 g_key_file_init (GKeyFile *key_file)
diff --git a/glib/glib-unix.c b/glib/glib-unix.c
index b26609a..bf7e291 100644
--- a/glib/glib-unix.c
+++ b/glib/glib-unix.c
@@ -43,11 +43,7 @@
  * "glib-unix.h" header.
  */
 
-GQuark
-g_unix_error_quark (void)
-{
-  return g_quark_from_static_string ("g-unix-error-quark");
-}
+G_DEFINE_QUARK ("g-unix-error-quark", g_unix_error)
 
 static gboolean
 g_unix_set_error_from_errno (GError **error,
diff --git a/glib/gmarkup.c b/glib/gmarkup.c
index 610854b..26a39b3 100644
--- a/glib/gmarkup.c
+++ b/glib/gmarkup.c
@@ -82,11 +82,7 @@
  * </itemizedlist>
  */
 
-GQuark
-g_markup_error_quark (void)
-{
-  return g_quark_from_static_string ("g-markup-error-quark");
-}
+G_DEFINE_QUARK ("g-markup-error-quark", g_markup_error)
 
 typedef enum
 {
diff --git a/glib/goption.c b/glib/goption.c
index 4ebc560..1798288 100644
--- a/glib/goption.c
+++ b/glib/goption.c
@@ -272,12 +272,7 @@ _g_utf8_strwidth (const gchar *p)
   return len;
 }
 
-
-GQuark
-g_option_error_quark (void)
-{
-  return g_quark_from_static_string ("g-option-context-error-quark");
-}
+G_DEFINE_QUARK ("g-option-context-error-quark", g_option_error)
 
 /**
  * g_option_context_new:
diff --git a/glib/gregex.c b/glib/gregex.c
index 54a4a17..4df6d92 100644
--- a/glib/gregex.c
+++ b/glib/gregex.c
@@ -1229,16 +1229,7 @@ g_match_info_fetch_all (const GMatchInfo *match_info)
 
 /* GRegex */
 
-GQuark
-g_regex_error_quark (void)
-{
-  static GQuark error_quark = 0;
-
-  if (error_quark == 0)
-    error_quark = g_quark_from_static_string ("g-regex-error-quark");
-
-  return error_quark;
-}
+G_DEFINE_QUARK ("g-regex-error-quark", g_regex_error)
 
 /**
  * g_regex_ref:
diff --git a/glib/gshell.c b/glib/gshell.c
index 205519e..2ea144b 100644
--- a/glib/gshell.c
+++ b/glib/gshell.c
@@ -54,11 +54,7 @@
  *
  * Error codes returned by shell functions.
  **/
-GQuark
-g_shell_error_quark (void)
-{
-  return g_quark_from_static_string ("g-shell-error-quark");
-}
+G_DEFINE_QUARK ("g-shell-error-quark", g_shell_error)
 
 /* Single quotes preserve the literal string exactly. escape
  * sequences are not allowed; not even \' - if you want a '
diff --git a/glib/gspawn-win32.c b/glib/gspawn-win32.c
index 6fca429..e5d0a16 100644
--- a/glib/gspawn-win32.c
+++ b/glib/gspawn-win32.c
@@ -205,17 +205,8 @@ protect_argv (gchar  **argv,
   return argc;
 }
 
-GQuark
-g_spawn_error_quark (void)
-{
-  return g_quark_from_static_string ("g-exec-error-quark");
-}
-
-GQuark
-g_spawn_exit_error_quark (void)
-{
-  return g_quark_from_static_string ("g-spawn-exit-error-quark");
-}
+G_DEFINE_QUARK ("g-exec-error-quark", g_spawn_error)
+G_DEFINE_QUARK ("g-spawn-exit-error-quark", g_spawn_exit_error)
 
 gboolean
 g_spawn_async_utf8 (const gchar          *working_directory,
diff --git a/glib/gspawn.c b/glib/gspawn.c
index 606b1c5..baff5e6 100644
--- a/glib/gspawn.c
+++ b/glib/gspawn.c
@@ -88,17 +88,8 @@ static gboolean fork_exec_with_pipes (gboolean              intermediate_child,
                                       gint                 *standard_error,
                                       GError              **error);
 
-GQuark
-g_spawn_error_quark (void)
-{
-  return g_quark_from_static_string ("g-exec-error-quark");
-}
-
-GQuark
-g_spawn_exit_error_quark (void)
-{
-  return g_quark_from_static_string ("g-spawn-exit-error-quark");
-}
+G_DEFINE_QUARK ("g-exec-error-quark", g_spawn_error)
+G_DEFINE_QUARK ("g-spawn-exit-error-quark", g_spawn_exit_error)
 
 /**
  * g_spawn_async:
diff --git a/glib/gthread.c b/glib/gthread.c
index c1d06ec..d3533b2 100644
--- a/glib/gthread.c
+++ b/glib/gthread.c
@@ -518,11 +518,7 @@
  *
  * The error domain of the GLib thread subsystem.
  **/
-GQuark
-g_thread_error_quark (void)
-{
-  return g_quark_from_static_string ("g_thread_error");
-}
+G_DEFINE_QUARK ("g_thread_error", g_thread_error)
 
 /* Local Data {{{1 -------------------------------------------------------- */
 
diff --git a/glib/gvariant-parser.c b/glib/gvariant-parser.c
index 0d1b093..a311c37 100644
--- a/glib/gvariant-parser.c
+++ b/glib/gvariant-parser.c
@@ -70,16 +70,7 @@
  *
  * Error codes returned by parsing text-format GVariants.
  **/
-GQuark
-g_variant_parser_get_error_quark (void)
-{
-  static GQuark the_quark;
-
-  if (the_quark == 0)
-    the_quark = g_quark_from_static_string ("g-variant-parse-error-quark");
-
-  return the_quark;
-}
+G_DEFINE_QUARK ("g-variant-parse-error-quark", g_variant_parser_get_error)
 
 typedef struct
 {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]