main.html
Main Page
|
classes.html
Alphabetical List
|
annotated.html
Data Structures
|
dirs.html
Directories
|
files.html
File List
|
functions.html
Data Fields
|
globals.html
Globals
dir_000000.html
libexif
exif-mem.c
exif-mem_8c.html
Go to the documentation of this file.
00001
#include <
exif-mem_8h.html
libexif/exif-mem.h
>
00002
00003
#include <stdlib.h>
00004
struct__ExifMem.html
00005
struct
struct__ExifMem.html
_ExifMem
{
struct__ExifMem.html#o0
00006
unsigned
int
struct__ExifMem.html#o0
ref_count
;
struct__ExifMem.html#o1
00007
exif-mem_8h.html#a0
ExifMemAllocFunc
struct__ExifMem.html#o1
alloc_func
;
struct__ExifMem.html#o2
00008
exif-mem_8h.html#a1
ExifMemReallocFunc
struct__ExifMem.html#o2
realloc_func
;
struct__ExifMem.html#o3
00009
exif-mem_8h.html#a2
ExifMemFreeFunc
struct__ExifMem.html#o3
free_func
;
00010 };
00011
00012
static
void
*
exif-mem_8c.html#a0
00013
exif-mem_8c.html#a0
exif_mem_alloc_func
(
exif-utils_8h.html#a6
ExifLong
ds)
00014 {
00015
return
calloc ((size_t) ds, 1);
00016 }
00017
00018
static
void
*
exif-mem_8c.html#a1
00019
exif-mem_8c.html#a1
exif_mem_realloc_func
(
void
*d,
exif-utils_8h.html#a6
ExifLong
ds)
00020 {
00021
return
realloc (d, (size_t) ds);
00022 }
00023
00024
static
void
exif-mem_8c.html#a2
00025
exif-mem_8c.html#a2
exif_mem_free_func
(
void
*d)
00026 {
00027         free (d);
00028 }
00029
00030
struct__ExifMem.html
ExifMem
*
exif-mem_8h.html#a4
00031
exif-mem_8c.html#a3
exif_mem_new
(
exif-mem_8h.html#a0
ExifMemAllocFunc
alloc_func,
exif-mem_8h.html#a1
ExifMemReallocFunc
realloc_func,
00032
exif-mem_8h.html#a2
ExifMemFreeFunc
free_func)
00033 {
00034
struct__ExifMem.html
ExifMem
*mem;
00035
00036
if
(!alloc_func || !realloc_func)
return
NULL;
00037         mem = alloc_func ? alloc_func (
sizeof
(
struct__ExifMem.html
ExifMem
)) :
00038                            realloc_func (NULL,
sizeof
(ExifMem));
00039
if
(!mem)
return
NULL;
00040         mem->
struct__ExifMem.html#o0
ref_count
= 1;
00041
00042         mem->
struct__ExifMem.html#o1
alloc_func
= alloc_func;
00043         mem->
struct__ExifMem.html#o2
realloc_func
= realloc_func;
00044         mem->
struct__ExifMem.html#o3
free_func
= free_func;
00045
00046
return
mem;
00047 }
00048
00049
void
exif-mem_8h.html#a5
00050
exif-mem_8c.html#a4
exif_mem_ref
(
struct__ExifMem.html
ExifMem
*mem)
00051 {
00052
if
(!mem)
return
;
00053         mem->
struct__ExifMem.html#o0
ref_count
++;
00054 }
00055
00056
void
exif-mem_8h.html#a6
00057
exif-mem_8c.html#a5
exif_mem_unref
(
struct__ExifMem.html
ExifMem
*mem)
00058 {
00059
if
(!mem)
return
;
00060
if
(!--mem->
struct__ExifMem.html#o0
ref_count
)
00061
exif-mem_8c.html#a6
exif_mem_free
(mem, mem);
00062 }
00063
00064
void
exif-mem_8h.html#a9
00065
exif-mem_8c.html#a6
exif_mem_free
(
struct__ExifMem.html
ExifMem
*mem,
void
*d)
00066 {
00067
if
(!mem)
return
;
00068
if
(mem->
struct__ExifMem.html#o3
free_func
) {
00069                 mem->
struct__ExifMem.html#o3
free_func
(d);
00070
return
;
00071         }
00072 }
00073
00074
void
*
exif-mem_8h.html#a7
00075
exif-mem_8c.html#a7
exif_mem_alloc
(
struct__ExifMem.html
ExifMem
*mem,
exif-utils_8h.html#a6
ExifLong
ds)
00076 {
00077
if
(!mem)
return
NULL;
00078
if
(mem->
struct__ExifMem.html#o1
alloc_func
|| mem->
struct__ExifMem.html#o2
realloc_func
)
00079
return
mem->
struct__ExifMem.html#o1
alloc_func
? mem->
struct__ExifMem.html#o1
alloc_func
(ds) :
00080                                          mem->
struct__ExifMem.html#o2
realloc_func
(NULL, ds);
00081
return
NULL;
00082 }
00083
00084
void
*
exif-mem_8h.html#a8
00085
exif-mem_8c.html#a8
exif_mem_realloc
(
struct__ExifMem.html
ExifMem
*mem,
void
*d,
exif-utils_8h.html#a6
ExifLong
ds)
00086 {
00087
return
(mem && mem->
struct__ExifMem.html#o2
realloc_func
) ? mem->
struct__ExifMem.html#o2
realloc_func
(d, ds) : NULL;
00088 }
00089
00090
struct__ExifMem.html
ExifMem
*
exif-mem_8h.html#a10
00091
exif-mem_8c.html#a9
exif_mem_new_default
(
void
)
00092 {
00093
return
exif-mem_8c.html#a3
exif_mem_new
(
exif-mem_8c.html#a0
exif_mem_alloc_func
,
exif-mem_8c.html#a1
exif_mem_realloc_func
,
00094
exif-mem_8c.html#a2
exif_mem_free_func
);
00095 }
Generated on Fri Sep 9 16:28:11 2005 for EXIF library (libexif) Internals by
http://www.doxygen.org/index.html
doxygen
1.4.4
