File: gallocator.c

package info (click to toggle)
glib2.0 2.86.2-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid
  • size: 66,452 kB
  • sloc: ansic: 544,604; python: 9,702; sh: 1,612; xml: 1,482; perl: 1,222; cpp: 535; makefile: 321; javascript: 11
file content (266 lines) | stat: -rw-r--r-- 4,408 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
/*
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */

#include "config.h"

/* we know we are deprecated here, no need for warnings */
#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS
#define GLIB_DISABLE_DEPRECATION_WARNINGS
#endif

#include "gallocator.h"

#include <glib/gmessages.h>
#include <glib/gslice.h>

/**
 * GAllocator:
 *
 * Deprecated: 2.10
 */

/**
 * G_ALLOC_ONLY:
 *
 * Deprecated: 2.10
 */

/**
 * G_ALLOC_AND_FREE:
 *
 * Deprecated: 2.10
 */

/**
 * G_ALLOCATOR_LIST:
 *
 * Deprecated: 2.10
 */

/**
 * G_ALLOCATOR_SLIST:
 *
 * Deprecated: 2.10
 */

/**
 * G_ALLOCATOR_NODE:
 *
 * Deprecated: 2.10
 */

/**
 * g_chunk_new:
 *
 * Deprecated: 2.10
 */

/**
 * g_chunk_new0:
 *
 * Deprecated: 2.10
 */

/**
 * g_chunk_free:
 *
 * Deprecated: 2.10
 */

/**
 * g_mem_chunk_create:
 *
 * Deprecated: 2.10
 */

/**
 * GMemChunk:
 *
 * Deprecated: 2.10
 */
struct _GMemChunk {
  guint alloc_size;           /* the size of an atom */
};

/**
 * g_mem_chunk_new:
 *
 * Deprecated: 2.10
 */
GMemChunk*
g_mem_chunk_new (const gchar *name,
                 gint         atom_size,
                 gsize        area_size,
                 gint         type)
{
  GMemChunk *mem_chunk;

  g_return_val_if_fail (atom_size > 0, NULL);

  mem_chunk = g_slice_new (GMemChunk);
  mem_chunk->alloc_size = (guint) atom_size;

  return mem_chunk;
}

/**
 * g_mem_chunk_destroy:
 *
 * Deprecated: 2.10
 */
void
g_mem_chunk_destroy (GMemChunk *mem_chunk)
{
  g_return_if_fail (mem_chunk != NULL);

  g_slice_free (GMemChunk, mem_chunk);
}

/**
 * g_mem_chunk_alloc:
 *
 * Deprecated: 2.10
 */
gpointer
g_mem_chunk_alloc (GMemChunk *mem_chunk)
{
  g_return_val_if_fail (mem_chunk != NULL, NULL);

  return g_slice_alloc (mem_chunk->alloc_size);
}

/**
 * g_mem_chunk_alloc0:
 *
 * Deprecated: 2.10
 */
gpointer
g_mem_chunk_alloc0 (GMemChunk *mem_chunk)
{
  g_return_val_if_fail (mem_chunk != NULL, NULL);

  return g_slice_alloc0 (mem_chunk->alloc_size);
}

/**
 * g_mem_chunk_free:
 *
 * Deprecated: 2.10
 */
void
g_mem_chunk_free (GMemChunk *mem_chunk,
                  gpointer   mem)
{
  g_return_if_fail (mem_chunk != NULL);

  g_slice_free1 (mem_chunk->alloc_size, mem);
}

/**
 * g_allocator_new:
 *
 * Deprecated: 2.10
 */
GAllocator*
g_allocator_new (const gchar *name,
                 guint        n_preallocs)
{
  /* some (broken) GAllocator uses depend on non-NULL allocators */
  return (void *) 1;
}

/**
 * g_allocator_free:
 *
 * Deprecated: 2.10
 */
void g_allocator_free           (GAllocator *allocator) { }

/**
 * g_mem_chunk_clean:
 *
 * Deprecated: 2.10
 */
void g_mem_chunk_clean          (GMemChunk *mem_chunk)  { }

/**
 * g_mem_chunk_reset:
 *
 * Deprecated: 2.10
 */
void g_mem_chunk_reset          (GMemChunk *mem_chunk)  { }

/**
 * g_mem_chunk_print:
 *
 * Deprecated: 2.10
 */
void g_mem_chunk_print          (GMemChunk *mem_chunk)  { }

/**
 * g_mem_chunk_info:
 *
 * Deprecated: 2.10
 */
void g_mem_chunk_info           (void)                  { }

/**
 * g_blow_chunks:
 *
 * Deprecated: 2.10
 */
void g_blow_chunks              (void)                  { }

/**
 * g_list_push_allocator:
 *
 * Deprecated: 2.10
 */
void g_list_push_allocator      (GAllocator *allocator) { }

/**
 * g_list_pop_allocator:
 *
 * Deprecated: 2.10
 */
void g_list_pop_allocator       (void)                  { }

/**
 * g_slist_push_allocator:
 *
 * Deprecated: 2.10
 */
void g_slist_push_allocator     (GAllocator *allocator) { }

/**
 * g_slist_pop_allocator:
 *
 * Deprecated: 2.10
 */
void g_slist_pop_allocator      (void)                  { }

/**
 * g_node_push_allocator:
 *
 * Deprecated: 2.10
 */
void g_node_push_allocator      (GAllocator *allocator) { }

/**
 * g_node_pop_allocator:
 *
 * Deprecated: 2.10
 */
void g_node_pop_allocator       (void)                  { }