Merge branch '896-variant-type-docs' into 'master'
[glib.git] / glib / deprecated / gallocator.c
blobad9695aeaedaf954bccc29909f51dcda00068f7f
1 /*
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/>.
16 #include "config.h"
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>
26 struct _GMemChunk {
27 guint alloc_size; /* the size of an atom */
30 GMemChunk*
31 g_mem_chunk_new (const gchar *name,
32 gint atom_size,
33 gsize area_size,
34 gint type)
36 GMemChunk *mem_chunk;
38 g_return_val_if_fail (atom_size > 0, NULL);
40 mem_chunk = g_slice_new (GMemChunk);
41 mem_chunk->alloc_size = atom_size;
43 return mem_chunk;
46 void
47 g_mem_chunk_destroy (GMemChunk *mem_chunk)
49 g_return_if_fail (mem_chunk != NULL);
51 g_slice_free (GMemChunk, mem_chunk);
54 gpointer
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);
62 gpointer
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);
70 void
71 g_mem_chunk_free (GMemChunk *mem_chunk,
72 gpointer mem)
74 g_return_if_fail (mem_chunk != NULL);
76 g_slice_free1 (mem_chunk->alloc_size, mem);
79 GAllocator*
80 g_allocator_new (const gchar *name,
81 guint n_preallocs)
83 /* some (broken) GAllocator uses depend on non-NULL allocators */
84 return (void *) 1;
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) { }