summary refs log tree commit diff
path: root/libnm-glib/nm-object-cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'libnm-glib/nm-object-cache.c')
-rw-r--r--libnm-glib/nm-object-cache.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/libnm-glib/nm-object-cache.c b/libnm-glib/nm-object-cache.c
index 2748b1df..752c606a 100644
--- a/libnm-glib/nm-object-cache.c
+++ b/libnm-glib/nm-object-cache.c
@@ -1,7 +1,5 @@
 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
- * libnm_glib -- Access network status & information from glib applications
- *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
@@ -17,9 +15,11 @@
  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  * Boston, MA 02110-1301 USA.
  *
- * Copyright (C) 2008 Red Hat, Inc.
+ * Copyright 2008 Red Hat, Inc.
  */
 
+#include "config.h"
+
 #include <string.h>
 #include <glib.h>
 #include "nm-object-cache.h"
@@ -65,27 +65,26 @@ _nm_object_cache_get (const char *path)
 }
 
 void
-_nm_object_cache_clear (NMObject *except)
+_nm_object_cache_clear (void)
 {
 	GHashTableIter iter;
-	NMObject *obj;
+	GObject *obj;
 	const char *path;
 	char *foo;
 
-	_init_cache ();
+	if (!cache)
+		return;
+
 	g_hash_table_iter_init (&iter, cache);
 	while (g_hash_table_iter_next (&iter, (gpointer) &path, (gpointer) &obj)) {
-		if (obj != except) {
-			/* Remove the callback so that if the object isn't yet released
-			 * by a client, when it does finally get unrefed, it won't trigger
-			 * the cache removal for a new object with the same path as the
-			 * one being released.
-			 */
-			foo = g_object_steal_data (G_OBJECT (obj), "nm-object-cache-tag");
-			g_free (foo);
+		/* Remove the callback so that if the object isn't yet released
+		 * by a client, when it does finally get unrefed, it won't trigger
+		 * the cache removal for a new object with the same path as the
+		 * one being released.
+		 */
+		foo = g_object_steal_data (obj, "nm-object-cache-tag");
+		g_free (foo);
 
-			g_hash_table_iter_remove (&iter);
-		}
+		g_hash_table_iter_remove (&iter);
 	}
 }
-