beagle r4657 - trunk/libbeagle/beagle
- From: arunsr svn gnome org
- To: svn-commits-list gnome org
- Subject: beagle r4657 - trunk/libbeagle/beagle
- Date: Sat, 5 Apr 2008 09:22:47 +0100 (BST)
Author: arunsr
Date: Sat Apr 5 09:22:47 2008
New Revision: 4657
URL: http://svn.gnome.org/viewvc/beagle?rev=4657&view=rev
Log:
Cleanups to previous commit
* Do a g_free() before g_strdup() so we don't leak memory on multiple calls
to the *_set_*() functions
* Don't warn on finding a NULL private field in finalize() -- if the object is
never used before being freed, the field will be NULL.
Modified:
trunk/libbeagle/beagle/beagle-query-part-human.c
trunk/libbeagle/beagle/beagle-query-part-property.c
trunk/libbeagle/beagle/beagle-query-part-text.c
trunk/libbeagle/beagle/beagle-query-part-uri.c
trunk/libbeagle/beagle/beagle-query-part-wildcard.c
Modified: trunk/libbeagle/beagle/beagle-query-part-human.c
==============================================================================
--- trunk/libbeagle/beagle/beagle-query-part-human.c (original)
+++ trunk/libbeagle/beagle/beagle-query-part-human.c Sat Apr 5 09:22:47 2008
@@ -66,7 +66,6 @@
BeagleQueryPartHuman *part = BEAGLE_QUERY_PART_HUMAN (obj);
BeagleQueryPartHumanPrivate *priv = BEAGLE_QUERY_PART_HUMAN_GET_PRIVATE (part);
- g_warn_if_fail (priv->string != NULL);
g_free (priv->string);
if (G_OBJECT_CLASS (parent_class)->finalize)
@@ -125,5 +124,6 @@
g_return_if_fail (string != NULL);
priv = BEAGLE_QUERY_PART_HUMAN_GET_PRIVATE (part);
+ g_free (priv->string);
priv->string = g_strdup (string);
}
Modified: trunk/libbeagle/beagle/beagle-query-part-property.c
==============================================================================
--- trunk/libbeagle/beagle/beagle-query-part-property.c (original)
+++ trunk/libbeagle/beagle/beagle-query-part-property.c Sat Apr 5 09:22:47 2008
@@ -82,11 +82,8 @@
BeagleQueryPartProperty *part = BEAGLE_QUERY_PART_PROPERTY (obj);
BeagleQueryPartPropertyPrivate *priv = BEAGLE_QUERY_PART_PROPERTY_GET_PRIVATE (part);
- g_warn_if_fail (priv->key != NULL);
-
g_free (priv->key);
- if (priv->value)
- g_free (priv->value);
+ g_free (priv->value); /* No-op if NULL */
if (G_OBJECT_CLASS (parent_class)->finalize)
G_OBJECT_CLASS (parent_class)->finalize (obj);
@@ -143,6 +140,7 @@
g_return_if_fail (key != NULL);
priv = BEAGLE_QUERY_PART_PROPERTY_GET_PRIVATE (part);
+ g_free (priv->key);
priv->key = g_strdup (key);
}
@@ -163,6 +161,7 @@
g_return_if_fail (BEAGLE_IS_QUERY_PART_PROPERTY (part));
priv = BEAGLE_QUERY_PART_PROPERTY_GET_PRIVATE (part);
+ g_free (priv->value);
priv->value = g_strdup (value);
}
Modified: trunk/libbeagle/beagle/beagle-query-part-text.c
==============================================================================
--- trunk/libbeagle/beagle/beagle-query-part-text.c (original)
+++ trunk/libbeagle/beagle/beagle-query-part-text.c Sat Apr 5 09:22:47 2008
@@ -78,7 +78,6 @@
BeagleQueryPartText *part = BEAGLE_QUERY_PART_TEXT (obj);
BeagleQueryPartTextPrivate *priv = BEAGLE_QUERY_PART_TEXT_GET_PRIVATE (part);
- g_warn_if_fail (priv->text != NULL);
g_free (priv->text);
if (G_OBJECT_CLASS (parent_class)->finalize)
@@ -139,6 +138,7 @@
g_return_if_fail (text != NULL);
priv = BEAGLE_QUERY_PART_TEXT_GET_PRIVATE (part);
+ g_free (priv->text);
priv->text = g_strdup (text);
}
Modified: trunk/libbeagle/beagle/beagle-query-part-uri.c
==============================================================================
--- trunk/libbeagle/beagle/beagle-query-part-uri.c (original)
+++ trunk/libbeagle/beagle/beagle-query-part-uri.c Sat Apr 5 09:22:47 2008
@@ -66,7 +66,6 @@
BeagleQueryPartUri *part = BEAGLE_QUERY_PART_URI (obj);
BeagleQueryPartUriPrivate *priv = BEAGLE_QUERY_PART_URI_GET_PRIVATE (part);
- g_warn_if_fail (priv->uri != NULL);
g_free (priv->uri);
if (G_OBJECT_CLASS (parent_class)->finalize)
@@ -127,5 +126,6 @@
g_return_if_fail (uri != NULL);
priv = BEAGLE_QUERY_PART_URI_GET_PRIVATE (part);
+ g_free (priv->uri);
priv->uri = g_strdup (uri);
}
Modified: trunk/libbeagle/beagle/beagle-query-part-wildcard.c
==============================================================================
--- trunk/libbeagle/beagle/beagle-query-part-wildcard.c (original)
+++ trunk/libbeagle/beagle/beagle-query-part-wildcard.c Sat Apr 5 09:22:47 2008
@@ -66,7 +66,6 @@
BeagleQueryPartWildcard *part = BEAGLE_QUERY_PART_WILDCARD (obj);
BeagleQueryPartWildcardPrivate *priv = BEAGLE_QUERY_PART_WILDCARD_GET_PRIVATE (part);
- g_warn_if_fail (priv->query_string != NULL);
g_free (priv->query_string);
if (G_OBJECT_CLASS (parent_class)->finalize)
@@ -132,5 +131,6 @@
g_return_if_fail (query_string != NULL);
priv = BEAGLE_QUERY_PART_WILDCARD_GET_PRIVATE (part);
+ g_free (priv->query_string);
priv->query_string = g_strdup (query_string);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]