moo_error_message: get error message from GError without crashing if error is NULL; removed unused parameter from save_config_file

This commit is contained in:
Yevgen Muntyan 2010-12-29 02:17:00 -08:00
parent 1f83e7bc47
commit 118b819c3c
2 changed files with 14 additions and 17 deletions

View File

@ -1716,8 +1716,7 @@ moo_get_user_cache_file (const char *basename)
static gboolean
save_config_file (const char *dir,
const char *filename,
save_config_file (const char *filename,
const char *content,
gssize len,
GError **error)
@ -1725,7 +1724,6 @@ save_config_file (const char *dir,
MooFileWriter *writer;
gboolean retval;
g_return_val_if_fail (dir != NULL, FALSE);
g_return_val_if_fail (filename != NULL, FALSE);
g_return_val_if_fail (content != NULL, FALSE);
@ -1745,26 +1743,19 @@ save_user_data_file (const char *basename,
gssize len,
GError **error)
{
char *dir, *file;
char *file;
gboolean result;
g_return_val_if_fail (basename != NULL, FALSE);
g_return_val_if_fail (content != NULL, FALSE);
if (cache)
{
dir = moo_get_user_cache_dir ();
file = moo_get_user_cache_file (basename);
}
else
{
dir = moo_get_user_data_dir ();
file = moo_get_user_data_file (basename);
}
result = save_config_file (dir, file, content, len, error);
result = save_config_file (file, content, len, error);
g_free (dir);
g_free (file);
return result;
}
@ -1793,17 +1784,13 @@ moo_save_config_file (const char *filename,
gssize len,
GError **error)
{
char *dir;
gboolean result;
g_return_val_if_fail (filename != NULL, FALSE);
g_return_val_if_fail (content != NULL, FALSE);
dir = g_path_get_dirname (filename);
result = save_config_file (filename, content, len, error);
result = save_config_file (dir, filename, content, len, error);
g_free (dir);
return result;
}
@ -2489,6 +2476,14 @@ moo_atom_uri_list (void)
}
const char *
moo_error_message (GError *error)
{
moo_return_val_if_fail (error != NULL, "error");
return error->message;
}
static char *debug_domains;
void _moo_set_debug (const char *domains);
gboolean moo_debug_enabled (const char *domain, gboolean def_enabled);

View File

@ -232,6 +232,8 @@ gboolean _moo_regex_escape (const char *string,
#define moo_obj_dup(type, p) ((type*) moo_dup_block (sizeof (type), p))
#endif
const char *moo_error_message (GError *error);
G_END_DECLS