gconf r2510 - in trunk: . backends examples gconf
- From: kmaraas svn gnome org
- To: svn-commits-list gnome org
- Subject: gconf r2510 - in trunk: . backends examples gconf
- Date: Thu, 10 Jan 2008 20:57:21 +0000 (GMT)
Author: kmaraas
Date: Thu Jan 10 20:57:20 2008
New Revision: 2510
URL: http://svn.gnome.org/viewvc/gconf?rev=2510&view=rev
Log:
2008-01-10 Kjartan Maraas <kmaraas gnome org>
* backends/evoldap-backend.c: (parse_server_info),
(destroy_source):
* backends/markup-tree.c: (markup_entry_set_value):
* backends/xml-dir.c: (create_fs_dir):
* backends/xml-entry.c: (entry_destroy), (entry_set_schema_name),
(entry_set_mod_user):
* examples/simple-view.c: (main):
* gconf/gconf-schema.c: (gconf_schema_free), (gconf_schema_copy):
* gconf/gconf-sources.c: (gconf_sources_query_value):
* gconf/gconf-value.c: (set_string), (gconf_value_free),
(gconf_entry_unref), (gconf_entry_set_schema_name):
* gconf/gconf.c: (gconf_engine_get_string):
g_free and friends handles NULL just fine.
Closes bug #371087 reported by Morten Welinder.
Modified:
trunk/ChangeLog
trunk/backends/evoldap-backend.c
trunk/backends/markup-tree.c
trunk/backends/xml-dir.c
trunk/backends/xml-entry.c
trunk/examples/simple-view.c
trunk/gconf/gconf-schema.c
trunk/gconf/gconf-sources.c
trunk/gconf/gconf-value.c
trunk/gconf/gconf.c
Modified: trunk/backends/evoldap-backend.c
==============================================================================
--- trunk/backends/evoldap-backend.c (original)
+++ trunk/backends/evoldap-backend.c Thu Jan 10 20:57:20 2008
@@ -377,8 +377,7 @@
host_value = xmlNodeGetContent (node);
- if (*host != NULL)
- g_free (*host);
+ g_free (*host);
*host = g_strdup ((char *) host_value);
xmlFree (host_value);
@@ -406,8 +405,7 @@
base_dn_value = xmlNodeGetContent (node);
- if (*base_dn != NULL)
- g_free (*base_dn);
+ g_free (*base_dn);
*base_dn = g_strdup ((char *) base_dn_value);
if (base_dn_value != NULL)
@@ -994,20 +992,16 @@
esource->template_calendar = NULL;
esource->template_tasks = NULL;
- if (esource->filter_str != NULL)
- g_free (esource->filter_str);
+ g_free (esource->filter_str);
esource->filter_str = NULL;
- if (esource->ldap_host != NULL)
- g_free (esource->ldap_host);
+ g_free (esource->ldap_host);
esource->ldap_host = NULL;
- if (esource->base_dn != NULL)
- g_free (esource->base_dn);
+ g_free (esource->base_dn);
esource->base_dn = NULL;
- if (esource->conf_file != NULL)
- g_free (esource->conf_file);
+ g_free (esource->conf_file);
esource->conf_file = NULL;
g_free (esource);
Modified: trunk/backends/markup-tree.c
==============================================================================
--- trunk/backends/markup-tree.c (original)
+++ trunk/backends/markup-tree.c Thu Jan 10 20:57:20 2008
@@ -1540,10 +1540,8 @@
g_slist_prepend (entry->local_schemas, local_schema);
}
- if (local_schema->short_desc)
- g_free (local_schema->short_desc);
- if (local_schema->long_desc)
- g_free (local_schema->long_desc);
+ g_free (local_schema->short_desc);
+ g_free (local_schema->long_desc);
if (local_schema->default_value)
gconf_value_free (local_schema->default_value);
Modified: trunk/backends/xml-dir.c
==============================================================================
--- trunk/backends/xml-dir.c (original)
+++ trunk/backends/xml-dir.c Thu Jan 10 20:57:20 2008
@@ -1245,8 +1245,7 @@
gconf_log(GCL_DEBUG, "failed parent: %s", parent);
g_free(parent);
- if (parent_xml)
- g_free(parent_xml);
+ g_free(parent_xml);
if (!success)
return FALSE;
Modified: trunk/backends/xml-entry.c
==============================================================================
--- trunk/backends/xml-entry.c (original)
+++ trunk/backends/xml-entry.c Thu Jan 10 20:57:20 2008
@@ -64,14 +64,12 @@
void
entry_destroy (Entry* e)
{
- if (e->name)
- g_free(e->name);
+ g_free(e->name);
if (e->cached_value)
gconf_value_free(e->cached_value);
- if (e->mod_user)
- g_free(e->mod_user);
+ g_free(e->mod_user);
if (e->node != NULL)
{
@@ -259,10 +257,9 @@
entry_set_schema_name (Entry *e,
const gchar *name)
{
- if (e->schema_name)
- g_free(e->schema_name);
+ g_free(e->schema_name);
- e->schema_name = name ? g_strdup(name) : NULL;
+ e->schema_name = g_strdup(name);
e->dirty = TRUE;
}
@@ -283,8 +280,7 @@
{
g_return_if_fail(e != NULL);
- if (e->mod_user)
- g_free(e->mod_user);
+ g_free(e->mod_user);
e->mod_user = g_strdup(user);
e->dirty = TRUE;
Modified: trunk/examples/simple-view.c
==============================================================================
--- trunk/examples/simple-view.c (original)
+++ trunk/examples/simple-view.c Thu Jan 10 20:57:20 2008
@@ -71,8 +71,7 @@
label = gtk_label_new(str ? str : "<unset>");
- if (str)
- g_free(str);
+ g_free(str);
gtk_container_add(GTK_CONTAINER(window), label);
Modified: trunk/gconf/gconf-schema.c
==============================================================================
--- trunk/gconf/gconf-schema.c (original)
+++ trunk/gconf/gconf-schema.c Thu Jan 10 20:57:20 2008
@@ -59,17 +59,10 @@
{
GConfRealSchema *real = REAL_SCHEMA (sc);
- if (real->locale)
- g_free (real->locale);
-
- if (real->short_desc)
- g_free (real->short_desc);
-
- if (real->long_desc)
- g_free (real->long_desc);
-
- if (real->owner)
- g_free (real->owner);
+ g_free (real->locale);
+ g_free (real->short_desc);
+ g_free (real->long_desc);
+ g_free (real->owner);
if (real->default_value)
gconf_value_free (real->default_value);
@@ -91,13 +84,13 @@
dest->car_type = real->car_type;
dest->cdr_type = real->cdr_type;
- dest->locale = real->locale ? g_strdup (real->locale) : NULL;
+ dest->locale = g_strdup (real->locale);
- dest->short_desc = real->short_desc ? g_strdup (real->short_desc) : NULL;
+ dest->short_desc = g_strdup (real->short_desc);
- dest->long_desc = real->long_desc ? g_strdup (real->long_desc) : NULL;
+ dest->long_desc = g_strdup (real->long_desc);
- dest->owner = real->owner ? g_strdup (real->owner) : NULL;
+ dest->owner = g_strdup (real->owner);
dest->default_value = real->default_value ? gconf_value_copy (real->default_value) : NULL;
Modified: trunk/gconf/gconf-sources.c
==============================================================================
--- trunk/gconf/gconf-sources.c (original)
+++ trunk/gconf/gconf-sources.c Thu Jan 10 20:57:20 2008
@@ -580,8 +580,7 @@
if (val)
gconf_value_free (val);
- if (schema_name)
- g_free (schema_name);
+ g_free (schema_name);
return NULL;
}
Modified: trunk/gconf/gconf-value.c
==============================================================================
--- trunk/gconf/gconf-value.c (original)
+++ trunk/gconf/gconf-value.c Thu Jan 10 20:57:20 2008
@@ -49,10 +49,8 @@
static void
set_string(gchar** dest, const gchar* src)
{
- if (*dest != NULL)
- g_free(*dest);
-
- *dest = src ? g_strdup(src) : NULL;
+ g_free(*dest);
+ *dest = g_strdup(src);
}
/*
@@ -808,8 +806,7 @@
switch (real->type)
{
case GCONF_VALUE_STRING:
- if (real->d.string_data != NULL)
- g_free(real->d.string_data);
+ g_free(real->d.string_data);
break;
case GCONF_VALUE_SCHEMA:
if (real->d.schema_data != NULL)
@@ -1492,8 +1489,7 @@
g_free (real->key);
if (real->value)
gconf_value_free (real->value);
- if (real->schema_name)
- g_free (real->schema_name);
+ g_free (real->schema_name);
g_slice_free (GConfRealEntry, real);
}
}
@@ -1630,10 +1626,9 @@
gconf_entry_set_schema_name(GConfEntry* entry,
const gchar* name)
{
- if (REAL_ENTRY (entry)->schema_name)
- g_free (REAL_ENTRY (entry)->schema_name);
+ g_free (REAL_ENTRY (entry)->schema_name);
- REAL_ENTRY (entry)->schema_name = name ? g_strdup(name) : NULL;
+ REAL_ENTRY (entry)->schema_name = g_strdup(name);
}
void
Modified: trunk/gconf/gconf.c
==============================================================================
--- trunk/gconf/gconf.c (original)
+++ trunk/gconf/gconf.c Thu Jan 10 20:57:20 2008
@@ -3182,7 +3182,7 @@
val = gconf_engine_get (conf, key, err);
if (val == NULL)
- return deflt ? g_strdup(deflt) : NULL;
+ return g_strdup(deflt);
else
{
gchar* retval;
@@ -3193,7 +3193,7 @@
*err = gconf_error_new(GCONF_ERROR_TYPE_MISMATCH, _("Expected string, got %s"),
gconf_value_type_to_string(val->type));
gconf_value_free(val);
- return deflt ? g_strdup(deflt) : NULL;
+ return g_strdup(deflt);
}
retval = gconf_value_steal_string (val);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]