changeset 2633:c079e507869a trunk

[svn] - use a managed heap for playlist entry node allocation.
author nenolod
date Tue, 20 Mar 2007 22:00:11 -0700
parents eefcf9c62175
children 704437e446d2
files ChangeLog src/audacious/build_stamp.c src/audacious/playlist.c src/audacious/playlist.h src/audacious/widgets/Makefile
diffstat 5 files changed, 20 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Mar 20 21:40:54 2007 -0700
+++ b/ChangeLog	Tue Mar 20 22:00:11 2007 -0700
@@ -1,3 +1,11 @@
+2007-03-21 04:40:54 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
+  revision [4282]
+  - typo
+  
+  trunk/configure.ac |    4 ++--
+  1 file changed, 2 insertions(+), 2 deletions(-)
+
+
 2007-03-21 04:39:00 +0000  William Pitcock <nenolod@sacredspiral.co.uk>
   revision [4280]
   - integrate libmowgli requirement into buildsystem
--- a/src/audacious/build_stamp.c	Tue Mar 20 21:40:54 2007 -0700
+++ b/src/audacious/build_stamp.c	Tue Mar 20 22:00:11 2007 -0700
@@ -1,2 +1,2 @@
 #include <glib.h>
-const gchar *svn_stamp = "20070321-4280";
+const gchar *svn_stamp = "20070321-4282";
--- a/src/audacious/playlist.c	Tue Mar 20 21:40:54 2007 -0700
+++ b/src/audacious/playlist.c	Tue Mar 20 22:00:11 2007 -0700
@@ -30,6 +30,7 @@
 
 #include "playlist.h"
 
+#include <mowgli.h>
 #include <glib.h>
 #include <glib/gprintf.h>
 #include <stdlib.h>
@@ -137,6 +138,8 @@
 static void playlist_recalc_total_time(Playlist *);
 static gboolean playlist_entry_get_info(PlaylistEntry * entry);
 
+static mowgli_heap_t *playlist_entry_heap = NULL;
+
 /* *********************** playlist entry code ********************** */
 
 PlaylistEntry *
@@ -147,7 +150,7 @@
 {
     PlaylistEntry *entry;
 
-    entry = g_new0(PlaylistEntry, 1);
+    entry = mowgli_heap_alloc(playlist_entry_heap);
     entry->filename = g_strdup(filename);
     entry->title = str_to_utf8(title);
     entry->length = length;
@@ -178,7 +181,7 @@
     if (entry->title != NULL)
         g_free(entry->title);
 
-    g_free(entry);
+    mowgli_heap_free(playlist_entry_heap, entry);
 }
 
 static gboolean
@@ -237,6 +240,10 @@
 {
     Playlist *initial_pl;
 
+    /* create a heap with 1024 playlist entry nodes preallocated. --nenolod */
+    playlist_entry_heap = mowgli_heap_create(sizeof(PlaylistEntry), 1024,
+	BH_NOW);
+
     /* FIXME: is this really necessary? REQUIRE_STATIC_LOCK(playlists); */
 
     initial_pl = playlist_new();
--- a/src/audacious/playlist.h	Tue Mar 20 21:40:54 2007 -0700
+++ b/src/audacious/playlist.h	Tue Mar 20 22:00:11 2007 -0700
@@ -23,6 +23,7 @@
 #ifndef PLAYLIST_H
 #define PLAYLIST_H
 
+#include <mowgli.h>
 #include <glib.h>
 #include "audacious/titlestring.h"
 #include "input.h"
--- a/src/audacious/widgets/Makefile	Tue Mar 20 21:40:54 2007 -0700
+++ b/src/audacious/widgets/Makefile	Tue Mar 20 22:00:11 2007 -0700
@@ -7,6 +7,7 @@
 
 CFLAGS += \
 	$(GTK_CFLAGS)      \
+	$(MOWGLI_CFLAGS)   \
 	$(LIBGLADE_CFLAGS) \
 	$(BEEP_DEFINES)    \
 	$(ARCH_DEFINES)    \