diff options
author | Jeff Garrett <jeff@jgarrett.org> | 2007-09-08 03:45:05 +0000 |
---|---|---|
committer | Jeff Garrett <jeff@jgarrett.org> | 2007-09-08 03:45:05 +0000 |
commit | 3c5a75d7ebfdd8e25609ba37bbcfdf87867aebd7 (patch) | |
tree | 069579611372044d4caa65a4f7571a661b731f09 | |
parent | e4ed779e28ab96ce4ed56c7c84b667fa8f84cac1 (diff) |
Remove (deprecated) GMemChunk
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/location.c | 10 | ||||
-rw-r--r-- | src/locationset.c | 13 |
3 files changed, 9 insertions, 19 deletions
@@ -1,5 +1,10 @@ 2007-09-08 Jeff Garrett <jeff@jgarrett.org> + * src/location.c: + * src/locationset.c: Remove (deprecated) GMemChunk + +2007-09-08 Jeff Garrett <jeff@jgarrett.org> + * src/main.c: Add configuration for external MySQL server * configure.ac: * src/db.c: Remove MySQL embedded server diff --git a/src/location.c b/src/location.c index fa21d2a..9f19c16 100644 --- a/src/location.c +++ b/src/location.c @@ -31,14 +31,10 @@ 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 +42,8 @@ gboolean location_alloc(location_t** ppLocation) { 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_new0(location_t); if(pNew) { *ppLocation = pNew; return TRUE; @@ -60,12 +55,11 @@ gboolean location_alloc(location_t** ppLocation) 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_free(location_t, pLocation); } gboolean location_insert(gint nLocationSetID, mappoint_t* pPoint, gint* pnReturnID) diff --git a/src/locationset.c b/src/locationset.c index 7e26070..3f058b7 100644 --- a/src/locationset.c +++ b/src/locationset.c @@ -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_slice_new0(locationset_t); // set defaults pNew->bVisible = TRUE; @@ -153,7 +144,7 @@ static void locationset_free(locationset_t* pLocationSet) locationset_clear(pLocationSet); // give back to allocator - g_mem_chunk_free(g_LocationSet.pLocationSetChunkAllocator, pLocationSet); + g_slice_free(locationset_t, pLocationSet); } static void locationset_clear_all_locations(void) |