2004-10-04 Lutz Mueller <lutz@users.sourceforge.net>
[platform/upstream/libexif.git] / libexif / exif-mem.h
1 /* exif-mem.h
2  *
3  * Copyright © 2003 Lutz Müller <lutz@users.sourceforge.net>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful, 
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of 
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details. 
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #ifndef __EXIF_MEM_H__
22 #define __EXIF_MEM_H__
23
24 #include <libexif/exif-utils.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif /* __cplusplus */
29
30 /* Should work like calloc: Needs to return initialized memory. */
31 typedef void * (* ExifMemAllocFunc)   (ExifLong);
32
33 typedef void * (* ExifMemReallocFunc) (void *, ExifLong);
34 typedef void   (* ExifMemFreeFunc)    (void *);
35
36 typedef struct _ExifMem ExifMem;
37
38 ExifMem *exif_mem_new   (ExifMemAllocFunc, ExifMemReallocFunc,
39                          ExifMemFreeFunc);
40 void     exif_mem_ref   (ExifMem *);
41 void     exif_mem_unref (ExifMem *);
42
43 void *exif_mem_alloc   (ExifMem *, ExifLong);
44 void *exif_mem_realloc (ExifMem *, void *, ExifLong);
45 void  exif_mem_free    (ExifMem *, void *);
46
47 /* For your convenience */
48 ExifMem *exif_mem_new_default (void);
49
50 #ifdef __cplusplus
51 }
52 #endif /* __cplusplus */
53
54 #endif /* __EXIF_MEM_H__ */