2 * mem.h - memory manipulation routines
4 * $Id: mem.h,v 1.7 2006-01-31 03:23:13 behdad Exp $
6 * $Date: 2006-01-31 03:23:13 $
8 * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/mem.h,v $
11 * Behdad Esfahbod, 2001, 2002, 2004
13 * Copyright (C) 2004 Sharif FarsiWeb, Inc
14 * Copyright (C) 2001,2002 Behdad Esfahbod
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License as published by the Free Software Foundation; either
19 * version 2.1 of the License, or (at your option) any later version.
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
26 * You should have received a copy of the GNU Lesser General Public License
27 * along with this library, in a file named COPYING; if not, write to the
28 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
29 * Boston, MA 02110-1301, USA
31 * For licensing issues, contact <license@farsiweb.info>.
38 #include <fribidi-types.h>
40 #include <fribidi-begindecls.h>
42 #if FRIBIDI_USE_GLIB+0
45 # include <glib/gmem.h>
46 #endif /* !__FRIBIDI_DOC */
48 #define FriBidiMemChunk GMemChunk
49 #define FRIBIDI_ALLOC_ONLY G_ALLOC_ONLY
50 #define fribidi_mem_chunk_new g_mem_chunk_new
51 #define fribidi_mem_chunk_alloc g_mem_chunk_alloc
52 #define fribidi_mem_chunk_destroy g_mem_chunk_destroy
54 #else /* !FRIBIDI_USE_GLIB */
56 typedef struct _FriBidiMemChunk FriBidiMemChunk;
58 #define FRIBIDI_ALLOC_ONLY 1
60 #define fribidi_mem_chunk_new FRIBIDI_PRIVATESPACE(mem_chunk_new)
62 fribidi_mem_chunk_new (
65 unsigned long area_size,
68 FRIBIDI_GNUC_HIDDEN FRIBIDI_GNUC_MALLOC FRIBIDI_GNUC_WARN_UNUSED;
70 #define fribidi_mem_chunk_alloc FRIBIDI_PRIVATESPACE(mem_chunk_alloc)
71 void *fribidi_mem_chunk_alloc (
72 FriBidiMemChunk *mem_chunk
74 FRIBIDI_GNUC_HIDDEN FRIBIDI_GNUC_MALLOC FRIBIDI_GNUC_WARN_UNUSED;
76 #define fribidi_mem_chunk_destroy FRIBIDI_PRIVATESPACE(mem_chunk_destroy)
77 void fribidi_mem_chunk_destroy (
78 FriBidiMemChunk *mem_chunk
79 ) FRIBIDI_GNUC_HIDDEN;
81 #endif /* !FRIBIDI_USE_GLIB */
83 #define fribidi_chunk_new(type, chunk) ( \
84 (type *) fribidi_mem_chunk_alloc (chunk) \
87 #define fribidi_chunk_new_for_type(type) ( \
88 fribidi_mem_chunk_new(FRIBIDI, sizeof (type), \
89 FRIBIDI_CHUNK_SIZE, FRIBIDI_ALLOC_ONLY) \
92 #include <fribidi-enddecls.h>
96 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent