2 * This library is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2.1 of the License, or (at your option) any later version.
7 * This library is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18 /* we know we are deprecated here, no need for warnings */
19 #define GLIB_DISABLE_DEPRECATION_WARNINGS
21 #include "gallocator.h"
23 #include <glib/gmessages.h>
24 #include <glib/gslice.h>
27 guint alloc_size
; /* the size of an atom */
31 g_mem_chunk_new (const gchar
*name
,
38 g_return_val_if_fail (atom_size
> 0, NULL
);
40 mem_chunk
= g_slice_new (GMemChunk
);
41 mem_chunk
->alloc_size
= atom_size
;
47 g_mem_chunk_destroy (GMemChunk
*mem_chunk
)
49 g_return_if_fail (mem_chunk
!= NULL
);
51 g_slice_free (GMemChunk
, mem_chunk
);
55 g_mem_chunk_alloc (GMemChunk
*mem_chunk
)
57 g_return_val_if_fail (mem_chunk
!= NULL
, NULL
);
59 return g_slice_alloc (mem_chunk
->alloc_size
);
63 g_mem_chunk_alloc0 (GMemChunk
*mem_chunk
)
65 g_return_val_if_fail (mem_chunk
!= NULL
, NULL
);
67 return g_slice_alloc0 (mem_chunk
->alloc_size
);
71 g_mem_chunk_free (GMemChunk
*mem_chunk
,
74 g_return_if_fail (mem_chunk
!= NULL
);
76 g_slice_free1 (mem_chunk
->alloc_size
, mem
);
80 g_allocator_new (const gchar
*name
,
83 /* some (broken) GAllocator uses depend on non-NULL allocators */
87 void g_allocator_free (GAllocator
*allocator
) { }
89 void g_mem_chunk_clean (GMemChunk
*mem_chunk
) { }
90 void g_mem_chunk_reset (GMemChunk
*mem_chunk
) { }
91 void g_mem_chunk_print (GMemChunk
*mem_chunk
) { }
92 void g_mem_chunk_info (void) { }
93 void g_blow_chunks (void) { }
95 void g_list_push_allocator (GAllocator
*allocator
) { }
96 void g_list_pop_allocator (void) { }
98 void g_slist_push_allocator (GAllocator
*allocator
) { }
99 void g_slist_pop_allocator (void) { }
101 void g_node_push_allocator (GAllocator
*allocator
) { }
102 void g_node_pop_allocator (void) { }