[Galago-commits] r2648 - in trunk/libgalago: . libgalago
galago-commits at freedesktop.org
galago-commits at freedesktop.org
Sun Apr 2 03:19:37 PDT 2006
Author: chipx86
Date: 2006-04-02 03:19:35 -0700 (Sun, 02 Apr 2006)
New Revision: 2648
Modified:
trunk/libgalago/ChangeLog
trunk/libgalago/libgalago/galago-context.c
Log:
More code condensing and memory leak fixing.
Modified: trunk/libgalago/ChangeLog
===================================================================
--- trunk/libgalago/ChangeLog 2006-04-02 09:58:59 UTC (rev 2647)
+++ trunk/libgalago/ChangeLog 2006-04-02 10:19:35 UTC (rev 2648)
@@ -1,3 +1,9 @@
+Sun Apr 02 03:19:10 PDT 2006 Christian Hammond <chipx86 at chipx86.com>
+
+ * libgalago/galago-context.c:
+ * tests/check-libgalago.c:
+ - More code condensing and memory leak fixing.
+
Sun Apr 02 01:58:15 PST 2006 Christian Hammond <chipx86 at chipx86.com>
* libgalago/galago-core.c:
Modified: trunk/libgalago/libgalago/galago-context.c
===================================================================
--- trunk/libgalago/libgalago/galago-context.c 2006-04-02 09:58:59 UTC (rev 2647)
+++ trunk/libgalago/libgalago/galago-context.c 2006-04-02 10:19:35 UTC (rev 2648)
@@ -137,9 +137,7 @@
{
ServiceCacheKey *key = (ServiceCacheKey *)ptr;
- if (key->id != NULL)
- g_free(key->id);
-
+ g_free(key->id);
g_free(key);
}
@@ -148,12 +146,8 @@
{
PersonCacheKey *key = (PersonCacheKey *)ptr;
- if (key->id != NULL)
- g_free(key->id);
-
- if (key->session_id != NULL)
- g_free(key->session_id);
-
+ g_free(key->id);
+ g_free(key->session_id);
g_free(key);
}
@@ -194,9 +188,7 @@
g_hash_table_destroy(context->priv->people_table);
g_hash_table_destroy(context->priv->obj_tree);
- if (context->priv->obj_path_prefix != NULL)
- g_free(context->priv->obj_path_prefix);
-
+ g_free(context->priv->obj_path_prefix);
g_free(context->priv);
context->priv = NULL;
}
@@ -256,12 +248,9 @@
g_return_if_fail(prefix != NULL);
context = galago_context_get();
-
g_return_if_fail(context != NULL);
- if (context->priv->obj_path_prefix != NULL)
- g_free(context->priv->obj_path_prefix);
-
+ g_free(context->priv->obj_path_prefix);
context->priv->obj_path_prefix = (prefix == NULL ? NULL : g_strdup(prefix));
}
@@ -460,19 +449,21 @@
static void
remove_person_from_table(GalagoPerson *person)
{
- GalagoContext *context = galago_context_get();
PersonCacheKey key;
+ GalagoContext *context = galago_context_get();
+ const char *id = galago_person_get_id(person);
const char *old_id = g_object_get_data(G_OBJECT(person),
"_galago_old_id");
if (old_id == NULL)
return;
- key.id = g_ascii_strdown(galago_person_get_id(person), -1);
+ key.id = (id == NULL ? NULL : g_ascii_strdown(id, -1));
key.session_id = g_strdup(galago_person_get_session_id(person));
key.origin = galago_object_get_origin(GALAGO_OBJECT(person));
g_hash_table_remove(context->priv->people_table, &key);
g_free(key.id);
+ g_free(key.session_id);
}
static void
@@ -482,7 +473,7 @@
const char *old_id = g_object_get_data(G_OBJECT(person),
"_galago_old_id");
- if (old_id != NULL && !strcmp(id, old_id))
+ if (id == old_id || (old_id != NULL && !strcmp(id, old_id)))
return;
remove_person_from_table(person);
More information about the galago-commits
mailing list