Use G_DEFINE_QUARK for GLib's own quarks

This commit just deals with glib/.
gobject/ and gio/ will be handled in separate commits.
This commit is contained in:
Matthias Clasen 2012-08-27 23:36:42 -04:00
parent 702b448865
commit 4f12f7c029
14 changed files with 17 additions and 98 deletions

View File

@ -1585,15 +1585,7 @@ timestamp_from_iso8601 (const gchar *iso_date)
return (time_t) stamp.tv_sec; return (time_t) stamp.tv_sec;
} }
G_DEFINE_QUARK ("g-bookmark-file-error-quark", g_bookmark_file_error)
GQuark
g_bookmark_file_error_quark (void)
{
return g_quark_from_static_string ("g-bookmark-file-error-quark");
}
/******************** /********************
* Public API * * Public API *

View File

@ -194,11 +194,7 @@
*/ */
#define NUL_TERMINATOR_LENGTH 4 #define NUL_TERMINATOR_LENGTH 4
GQuark G_DEFINE_QUARK ("g_convert_error", g_convert_error)
g_convert_error_quark (void)
{
return g_quark_from_static_string ("g_convert_error");
}
static gboolean static gboolean
try_conversion (const char *to_codeset, try_conversion (const char *to_codeset,

View File

@ -459,11 +459,7 @@ g_file_test (const gchar *filename,
#endif #endif
} }
GQuark G_DEFINE_QUARK ("g-file-error-quark", g_file_error)
g_file_error_quark (void)
{
return g_quark_from_static_string ("g-file-error-quark");
}
/** /**
* g_file_error_from_errno: * g_file_error_from_errno:

View File

@ -2580,8 +2580,5 @@ g_io_channel_write_unichar (GIOChannel *channel,
* *
* Error codes returned by #GIOChannel operations. * Error codes returned by #GIOChannel operations.
**/ **/
GQuark
g_io_channel_error_quark (void) G_DEFINE_QUARK ("g-io-channel-error-quark", g_io_channel_error)
{
return g_quark_from_static_string ("g-io-channel-error-quark");
}

View File

@ -554,12 +554,7 @@ static void g_key_file_parse_data (GKeyFile
static void g_key_file_flush_parse_buffer (GKeyFile *key_file, static void g_key_file_flush_parse_buffer (GKeyFile *key_file,
GError **error); GError **error);
G_DEFINE_QUARK ("g-key-file-error-quark", g_key_file_error)
GQuark
g_key_file_error_quark (void)
{
return g_quark_from_static_string ("g-key-file-error-quark");
}
static void static void
g_key_file_init (GKeyFile *key_file) g_key_file_init (GKeyFile *key_file)

View File

@ -43,11 +43,7 @@
* "glib-unix.h" header. * "glib-unix.h" header.
*/ */
GQuark G_DEFINE_QUARK ("g-unix-error-quark", g_unix_error)
g_unix_error_quark (void)
{
return g_quark_from_static_string ("g-unix-error-quark");
}
static gboolean static gboolean
g_unix_set_error_from_errno (GError **error, g_unix_set_error_from_errno (GError **error,

View File

@ -82,11 +82,7 @@
* </itemizedlist> * </itemizedlist>
*/ */
GQuark G_DEFINE_QUARK ("g-markup-error-quark", g_markup_error)
g_markup_error_quark (void)
{
return g_quark_from_static_string ("g-markup-error-quark");
}
typedef enum typedef enum
{ {

View File

@ -272,12 +272,7 @@ _g_utf8_strwidth (const gchar *p)
return len; return len;
} }
G_DEFINE_QUARK ("g-option-context-error-quark", g_option_error)
GQuark
g_option_error_quark (void)
{
return g_quark_from_static_string ("g-option-context-error-quark");
}
/** /**
* g_option_context_new: * g_option_context_new:

View File

@ -1229,16 +1229,7 @@ g_match_info_fetch_all (const GMatchInfo *match_info)
/* GRegex */ /* GRegex */
GQuark G_DEFINE_QUARK ("g-regex-error-quark", g_regex_error)
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_regex_ref: * g_regex_ref:

View File

@ -54,11 +54,7 @@
* *
* Error codes returned by shell functions. * Error codes returned by shell functions.
**/ **/
GQuark G_DEFINE_QUARK ("g-shell-error-quark", g_shell_error)
g_shell_error_quark (void)
{
return g_quark_from_static_string ("g-shell-error-quark");
}
/* Single quotes preserve the literal string exactly. escape /* Single quotes preserve the literal string exactly. escape
* sequences are not allowed; not even \' - if you want a ' * sequences are not allowed; not even \' - if you want a '

View File

@ -205,17 +205,8 @@ protect_argv (gchar **argv,
return argc; return argc;
} }
GQuark G_DEFINE_QUARK ("g-exec-error-quark", g_spawn_error)
g_spawn_error_quark (void) G_DEFINE_QUARK ("g-spawn-exit-error-quark", g_spawn_exit_error)
{
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");
}
gboolean gboolean
g_spawn_async_utf8 (const gchar *working_directory, g_spawn_async_utf8 (const gchar *working_directory,

View File

@ -88,17 +88,8 @@ static gboolean fork_exec_with_pipes (gboolean intermediate_child,
gint *standard_error, gint *standard_error,
GError **error); GError **error);
GQuark G_DEFINE_QUARK ("g-exec-error-quark", g_spawn_error)
g_spawn_error_quark (void) G_DEFINE_QUARK ("g-spawn-exit-error-quark", g_spawn_exit_error)
{
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_spawn_async: * g_spawn_async:

View File

@ -518,11 +518,7 @@
* *
* The error domain of the GLib thread subsystem. * The error domain of the GLib thread subsystem.
**/ **/
GQuark G_DEFINE_QUARK ("g_thread_error", g_thread_error)
g_thread_error_quark (void)
{
return g_quark_from_static_string ("g_thread_error");
}
/* Local Data {{{1 -------------------------------------------------------- */ /* Local Data {{{1 -------------------------------------------------------- */

View File

@ -70,16 +70,7 @@
* *
* Error codes returned by parsing text-format GVariants. * Error codes returned by parsing text-format GVariants.
**/ **/
GQuark G_DEFINE_QUARK ("g-variant-parse-error-quark", g_variant_parser_get_error)
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;
}
typedef struct typedef struct
{ {