Redesigned the WMUD_*_ERROR GQuarks

They are now conform to GLib's method (which is more secure I think)

Signed-off-by: Gergely Polonkai (W00d5t0ck) <polesz@w00d5t0ck.info>
This commit is contained in:
Gergely Polonkai (W00d5t0ck) 2012-03-30 17:43:45 +02:00
parent 8835cb258b
commit 4e659a9ef7
9 changed files with 33 additions and 21 deletions

View File

@ -33,12 +33,6 @@
*
*/
/**
* WMUD_CONFIG_ERROR:
*
* the GQuark for the config error GError
*/
GQuark WMUD_CONFIG_ERROR = 0;
/**
* active_config:
*
@ -46,6 +40,12 @@ GQuark WMUD_CONFIG_ERROR = 0;
*/
ConfigData *active_config = NULL;
GQuark
wmud_config_error_quark()
{
return g_quark_from_static_string("wmud-config-error");
}
/**
* wmud_configdata_free:
* @config_data: pointer to the ConfigData struct to free

View File

@ -3,7 +3,9 @@
#include <glib.h>
extern GQuark WMUD_CONFIG_ERROR;
#define WMUD_CONFIG_ERROR wmud_config_error_quark()
GQuark wmud_config_error_quark();
/**
* wmudConfigError:

View File

@ -36,14 +36,14 @@
* different (e.g MySQL or PostgreSQL) database.
*/
/**
* WMUD_DB_ERROR:
*
* the GQuark for the database error GError
*/
GQuark WMUD_DB_ERROR = 0;
static sqlite3 *dbh = NULL;
GQuark
wmud_db_error_quark()
{
return g_quark_from_static_string("wmud-db-error");
}
/**
* wmud_db_init:
* @err: a GError to put error messages in it

View File

@ -23,7 +23,8 @@
#include "wmud-types.h"
extern GQuark WMUD_DB_ERROR;
#define WMUD_DB_ERROR wmud_db_error_quark()
GQuark wmud_db_error_quark();
/**
* wmudDbError:

View File

@ -45,6 +45,12 @@ static wmudCommand command_list[] = {
{ NULL, NULL },
};
GQuark
wmud_interpreter_error_quark()
{
return g_quark_from_static_string("wmud-interpreter-error");
}
/**
* destroy_string:
* @string: a GString to destroy

View File

@ -51,7 +51,8 @@ typedef struct _wmudCommand {
wmudCommandFunc commandFunc;
} wmudCommand;
GQuark WMUD_INTERPRETER_ERROR;
#define WMUD_INTERPRETER_ERROR wmud_interpreter_error_quark()
GQuark wmud_interpreter_error_quark();
typedef enum {
WMUD_INTERPRETER_ERROR_DUPCMD

View File

@ -121,10 +121,6 @@ debug_context(char *file, int line)
void
wmud_type_init(void)
{
WMUD_CONFIG_ERROR = g_quark_from_string("wmud-config-error");
WMUD_DB_ERROR = g_quark_from_string("wmud-db-error");
WMUD_INTERPRETER_ERROR = g_quark_from_string("wmud-interpreter-error");
WMUD_WORLD_ERROR = g_quark_from_string("wmud-world-error");
}
/**

View File

@ -41,7 +41,11 @@ struct dirCheckData {
gboolean sane;
};
GQuark WMUD_WORLD_ERROR = 0;
GQuark
wmud_world_error_quark()
{
return g_quark_from_static_string("wmud-world-error");
}
static gint
check_plane_dups2(wmudPlane *plane, gchar *name)

View File

@ -21,7 +21,9 @@
#include <glib.h>
extern GQuark WMUD_WORLD_ERROR;
#define WMUD_WORLD_ERROR wmud_world_error_quark()
GQuark wmud_world_error_quark();
typedef enum {
WMUD_WORLD_ERROR_DUPPLANE,
WMUD_WORLD_ERROR_DUPPLANET,