[cairo-commit] roadster/src location.c, 1.9, 1.10 locationset.c, 1.16, 1.17
Jeff Garrett
commit at pdx.freedesktop.org
Sat Sep 8 01:45:08 PDT 2007
Committed by: jgarrett
Update of /cvs/cairo/roadster/src
In directory kemper:/tmp/cvs-serv26730/src
Modified Files:
location.c locationset.c
Log Message:
* src/location.c:
* src/locationset.c: Remove (deprecated) GMemChunk
Index: location.c
===================================================================
RCS file: /cvs/cairo/roadster/src/location.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- location.c 26 Oct 2005 06:53:23 -0000 1.9
+++ location.c 8 Sep 2007 08:45:06 -0000 1.10
@@ -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 @@
{
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 @@
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)
Index: locationset.c
===================================================================
RCS file: /cvs/cairo/roadster/src/locationset.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- locationset.c 30 Sep 2005 05:09:51 -0000 1.16
+++ locationset.c 8 Sep 2007 08:45:06 -0000 1.17
@@ -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 @@
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)
More information about the cairo-commit
mailing list