Gentlemen,
What you are seeing is a change in the Glib/GTK+ way of allocating
memory. Starting with GTK+/Glib 2.10, they switched away from GMemChunk
to a "slice" format for speed and memory efficiency. The result is that
anything using the old format won't compile right now. I believe Ian is
working on a better method for doing that so it will be compatible with
both.
Attached is a patch that Casey Harkins posted on June 13 of this year
("PATCH re:unable to compile on gcc 4.1") to make the API changes to
Roadster. I've applied it to my tree and it has worked for me. It
should only be applied if you're seeing the errors you described, as it
will make the source incompatible with GTK+ < 2.10.
-KW
Index: src/location.c
===================================================================
RCS file: /cvs/cairo/roadster/src/location.c,v
retrieving revision 1.9
diff -u -d -p -r1.9 location.c
--- src/location.c 26 Oct 2005 06:53:23 -0000 1.9
+++ src/location.c 13 Jun 2006 12:16:11 -0000
@@ -30,15 +30,8 @@
gboolean location_lookup_attribute_name(const gchar* pszName, gint* pnReturnID);
-struct {
- GMemChunk* pLocationChunkAllocator;
-} g_Location;
-
void location_init()
{
- g_Location.pLocationChunkAllocator = g_mem_chunk_new("ROADSTER locations",
- sizeof(location_t), sizeof(location_t) * 1000, G_ALLOC_AND_FREE);
- g_return_if_fail(g_Location.pLocationChunkAllocator != NULL);
}
// get a new point struct from the allocator
@@ -46,9 +39,8 @@ gboolean location_alloc(location_t** ppL
{
g_return_val_if_fail(ppLocation != NULL, FALSE);
g_return_val_if_fail(*ppLocation == NULL, FALSE); // must be a pointer to a NULL pointer
- g_return_val_if_fail(g_Location.pLocationChunkAllocator != NULL, FALSE);
- location_t* pNew = g_mem_chunk_alloc0(g_Location.pLocationChunkAllocator);
+ location_t* pNew = g_slice_alloc0(sizeof(location_t));
if(pNew) {
*ppLocation = pNew;
return TRUE;
@@ -60,12 +52,11 @@ gboolean location_alloc(location_t** ppL
void location_free(location_t* pLocation)
{
g_return_if_fail(pLocation != NULL);
- g_return_if_fail(g_Location.pLocationChunkAllocator != NULL);
g_free(pLocation->pszName);
// give back to allocator
- g_mem_chunk_free(g_Location.pLocationChunkAllocator, pLocation);
+ g_slice_free1(sizeof(location_t), pLocation);
}
gboolean location_insert(gint nLocationSetID, mappoint_t* pPoint, gint* pnReturnID)
Index: src/locationset.c
===================================================================
RCS file: /cvs/cairo/roadster/src/locationset.c,v
retrieving revision 1.16
diff -u -d -p -r1.16 locationset.c
--- src/locationset.c 30 Sep 2005 05:09:51 -0000 1.16
+++ src/locationset.c 13 Jun 2006 12:16:12 -0000
@@ -37,27 +37,18 @@
struct {
GPtrArray* pLocationSetArray; // an array of locationsets
GHashTable* pLocationSetHash; // stores pointers to locationsets, indexed by ID
-
- GMemChunk* pLocationSetChunkAllocator; // allocs locationset_t objects
} g_LocationSet;
void locationset_init()
{
g_LocationSet.pLocationSetArray = g_ptr_array_new();
g_LocationSet.pLocationSetHash = g_hash_table_new(g_int_hash, g_int_equal);
-
- // create memory allocator
- g_LocationSet.pLocationSetChunkAllocator = g_mem_chunk_new("ROADSTER locationsets",
- sizeof(locationset_t), sizeof(locationset_t) * 20, G_ALLOC_AND_FREE);
- g_return_if_fail(g_LocationSet.pLocationSetChunkAllocator != NULL);
}
// get a new locationset struct from the allocator
static gboolean locationset_alloc(locationset_t** ppReturn)
{
- g_return_val_if_fail(g_LocationSet.pLocationSetChunkAllocator != NULL, FALSE);
-
- locationset_t* pNew = g_mem_chunk_alloc0(g_LocationSet.pLocationSetChunkAllocator);
+ locationset_t* pNew = g_mem_chunk_alloc0(sizeof(locationset_t));
// set defaults
pNew->bVisible = TRUE;
@@ -153,7 +144,7 @@ static void locationset_free(locationset
locationset_clear(pLocationSet);
// give back to allocator
- g_mem_chunk_free(g_LocationSet.pLocationSetChunkAllocator, pLocationSet);
+ g_slice_free1(sizeof(locationset_t), pLocationSet);
}
static void locationset_clear_all_locations(void)
_______________________________________________
roadster mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/roadster