All pastes #81239 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-07-07 08:00 UTC
rendered paste body
diff -u -p -r1.232 rhythmdb.c
--- rhythmdb/rhythmdb.c	7 Jul 2006 03:00:45 -0000	1.232
+++ rhythmdb/rhythmdb.c	7 Jul 2006 07:58:05 -0000
@@ -2627,6 +2627,7 @@ rhythmdb_entry_sync_mirrored (RhythmDBEn
 	static const char *format;
 	static const char *never;
 	char *val;
+	gpointer *ptr;
 
 	/* PERFORMANCE: doing these lookups every call creates a noticable slowdown */
 	if (format == NULL)
@@ -2642,7 +2643,8 @@ rhythmdb_entry_sync_mirrored (RhythmDBEn
 		if (!(entry->flags & RHYTHMDB_ENTRY_LAST_PLAYED_DIRTY))
 			break;
 
-		old = g_atomic_pointer_get (&entry->last_played_str);
+		ptr = (gpointer*)&entry->last_played_str;
+		old = g_atomic_pointer_get (ptr);
 		if (entry->last_played == 0) {
 			new = rb_refstring_new (never);
 		} else {
@@ -2651,7 +2653,7 @@ rhythmdb_entry_sync_mirrored (RhythmDBEn
 			g_free (val);
 		}
 
-		if (g_atomic_pointer_compare_and_exchange ((gpointer*)&entry->last_played_str, old, new))
+		if (g_atomic_pointer_compare_and_exchange (ptr, old, new))
 			rb_refstring_unref (old);
 		else
 			rb_refstring_unref (new);
@@ -2665,12 +2667,13 @@ rhythmdb_entry_sync_mirrored (RhythmDBEn
 		if (!(entry->flags & RHYTHMDB_ENTRY_FIRST_SEEN_DIRTY))
 			break;
 
-		old = g_atomic_pointer_get (&entry->first_seen_str);
+		ptr = (gpointer*)&entry->first_seen_str;
+		old = g_atomic_pointer_get (ptr);
 		val = eel_strdup_strftime (format, localtime ((glong*)&entry->first_seen));
 		new = rb_refstring_new (val);
 		g_free (val);
 
-		if (g_atomic_pointer_compare_and_exchange ((gpointer*)&entry->first_seen_str, old, new))
+		if (g_atomic_pointer_compare_and_exchange (ptr, old, new))
 			rb_refstring_unref (old);
 		else
 			rb_refstring_unref (new);
@@ -2683,7 +2686,8 @@ rhythmdb_entry_sync_mirrored (RhythmDBEn
 		if (!(entry->flags & RHYTHMDB_ENTRY_LAST_SEEN_DIRTY))
 			break;
 
-		old = g_atomic_pointer_get (&entry->last_seen_str);
+		ptr = (gpointer*)&entry->last_seen_str;
+		old = g_atomic_pointer_get (ptr);
 		/* only store last seen time as a string for hidden entries */
 		if (entry->flags & RHYTHMDB_ENTRY_HIDDEN) {
 			val = eel_strdup_strftime (format, localtime ((glong*)&entry->last_seen));
@@ -2693,7 +2697,7 @@ rhythmdb_entry_sync_mirrored (RhythmDBEn
 			new = NULL;
 		}
 
-		if (g_atomic_pointer_compare_and_exchange ((gpointer*)&entry->first_seen_str, old, new))
+		if (g_atomic_pointer_compare_and_exchange (ptr, old, new))
 			rb_refstring_unref (old);
 		else
 			rb_refstring_unref (new);