Hey Barry,
Just trying to get roadster running on fc5 myself. I did get everything
to compile up until it tries to link with the embedded mysql server
(re-building mysql rpms now with embedded server enabled).
The attached patch replaces roadster's usage of the deprecated GMemChunk
api (which is apparently no longer available on fc5) with the g_slice api.
Since I don't have mysql embedded yet, this is entirely untested. I'll
report back with success/failure.
Has anyone made progress on replacing mysql embedded with sqlite?
-casey
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