r7199 - in dumbhippo/trunk/client: common/hippo common/stacker linux/src



Author: otaylor
Date: 2008-01-14 13:21:07 -0600 (Mon, 14 Jan 2008)
New Revision: 7199

Modified:
   dumbhippo/trunk/client/common/hippo/hippo-basics.h
   dumbhippo/trunk/client/common/stacker/hippo-object-cache.c
   dumbhippo/trunk/client/linux/src/main.h
Log:
Move the HIPPO_ADD/REMOVE_WEAK macros to the one place they are used

Modified: dumbhippo/trunk/client/common/hippo/hippo-basics.h
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-basics.h	2008-01-14 19:01:48 UTC (rev 7198)
+++ dumbhippo/trunk/client/common/hippo/hippo-basics.h	2008-01-14 19:21:07 UTC (rev 7199)
@@ -288,9 +288,6 @@
 char*    hippo_size_photo_url              (const char *base_url,
                                             int         size);
 
-#define HIPPO_ADD_WEAK(ptr)    g_object_add_weak_pointer(G_OBJECT(*(ptr)), (void**) (char*) (ptr))
-#define HIPPO_REMOVE_WEAK(ptr) do { if (*ptr) { g_object_remove_weak_pointer(G_OBJECT(*(ptr)), (void**) (char*) (ptr)); *ptr = NULL; } } while(0)
-
 G_END_DECLS
 
 #endif /* __HIPPO_BASICS_H__ */

Modified: dumbhippo/trunk/client/common/stacker/hippo-object-cache.c
===================================================================
--- dumbhippo/trunk/client/common/stacker/hippo-object-cache.c	2008-01-14 19:01:48 UTC (rev 7198)
+++ dumbhippo/trunk/client/common/stacker/hippo-object-cache.c	2008-01-14 19:21:07 UTC (rev 7199)
@@ -8,6 +8,10 @@
 /* how often to retry on failure */
 #define RETRY_INTERVAL_SECONDS (60*2)
 
+
+#define ADD_WEAK(ptr)    g_object_add_weak_pointer(G_OBJECT(*(ptr)), (void**) (char*) (ptr))
+#define REMOVE_WEAK(ptr) do { if (*ptr) { g_object_remove_weak_pointer(G_OBJECT(*(ptr)), (void**) (char*) (ptr)); *ptr = NULL; } } while(0)
+
 typedef struct {
     HippoObjectCacheLoadFunc  func;
     void                     *data;
@@ -69,7 +73,7 @@
     entry = g_new0(CacheEntry, 1);
     entry->refcount = 1;
     entry->cache = cache;
-    HIPPO_ADD_WEAK(&entry->cache);
+    ADD_WEAK(&entry->cache);
     entry->url = g_strdup(url);
     return entry;
 }
@@ -80,9 +84,9 @@
     g_return_if_fail(!entry->loading);
     
     /* be sure all callbacks get an error reply if they haven't */
-    HIPPO_REMOVE_WEAK(&entry->cache);
+    REMOVE_WEAK(&entry->cache);
     entry->cache = NULL;
-    HIPPO_REMOVE_WEAK(&entry->cached_obj);
+    REMOVE_WEAK(&entry->cached_obj);
     entry->cached_obj = NULL;
 
     while (entry->callbacks != NULL) {
@@ -184,7 +188,7 @@
     }
 
     if (entry->cached_obj)
-        HIPPO_ADD_WEAK(&entry->cached_obj);
+        ADD_WEAK(&entry->cached_obj);
 
     /* if cached_obj is NULL we failed, otherwise we succeeded.
      * either way we invoke the callbacks.

Modified: dumbhippo/trunk/client/linux/src/main.h
===================================================================
--- dumbhippo/trunk/client/linux/src/main.h	2008-01-14 19:01:48 UTC (rev 7198)
+++ dumbhippo/trunk/client/linux/src/main.h	2008-01-14 19:21:07 UTC (rev 7199)
@@ -64,10 +64,6 @@
                                          int      *x_p,
                                          int      *y_p);
 
-/* FIXME just change all references to have the HIPPO_ */
-#define ADD_WEAK(ptr)    HIPPO_ADD_WEAK(ptr)
-#define REMOVE_WEAK(ptr) HIPPO_REMOVE_WEAK(ptr)
-
 G_END_DECLS
 
 #endif /* __HIPPO_MAIN_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]