# HG changeset patch # User Ethan Blanton # Date 1070829847 0 # Node ID 069ee4ecb56ae3bd6f07ba0c3a267ec1252b9349 # Parent d2710acd0020ba9cca80166b36fd34266e9245f9 [gaim-migrate @ 8441] Everybody likes a good macro! committer: Tailor Script diff -r d2710acd0020 -r 069ee4ecb56a src/stringref.c --- a/src/stringref.c Sun Dec 07 20:21:15 2003 +0000 +++ b/src/stringref.c Sun Dec 07 20:44:07 2003 +0000 @@ -30,6 +30,8 @@ #include "debug.h" #include "stringref.h" +#define REFCOUNT(x) ((x) & 0x7fffffff) + static GList *gclist = NULL; static void stringref_free(GaimStringref *stringref); @@ -96,7 +98,7 @@ { if (stringref == NULL) return; - if ((--(stringref->ref) & 0x7fffffff) == 0) { + if (REFCOUNT(--(stringref->ref)) == 0) { if (stringref->ref & 0x80000000) gclist = g_list_remove(gclist, stringref); stringref_free(stringref); @@ -121,7 +123,7 @@ static void stringref_free(GaimStringref *stringref) { #ifdef DEBUG - if (stringref->ref != 0) { + if (REFCOUNT(stringref->ref) != 0) { gaim_debug(GAIM_DEBUG_ERROR, "stringref", "Free of nonzero (%d) ref stringref!\n", stringref->ref); return; } @@ -136,8 +138,7 @@ while (gclist != NULL) { ref = gclist->data; - ref->ref &= 0x7fffffff; - if (ref->ref == 0) { + if (REFCOUNT(ref->ref) == 0) { stringref_free(ref); } del = gclist;