libUnihan
0.5.3
Main Page
Modules
Data Structures
Files
File List
Globals
src
allocate.h
Go to the documentation of this file.
1
9
/*
10
* Copyright © 2008 Red Hat, Inc. All rights reserved.
11
* Copyright © 2008 Ding-Yi Chen <dchen at redhat dot com>
12
*
13
* This file is part of the libUnihan Project.
14
*
15
* This library is free software; you can redistribute it and/or
16
* modify it under the terms of the GNU Lesser General Public
17
* License as published by the Free Software Foundation; either
18
* version 2 of the License, or (at your option) any later version.
19
*
20
* This library is distributed in the hope that it will be useful,
21
* but WITHOUT ANY WARRANTY; without even the implied warranty of
22
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
* GNU Lesser General Public License for more details.
24
*
25
* You should have received a copy of the GNU Lesser General Public
26
* License along with this program; if not, write to the
27
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
28
* Boston, MA 02111-1307 USA
29
*/
30
31
#ifndef ALLOCATE_UTILS_H_
32
#define ALLOCATE_UTILS_H_
33
#include <stdlib.h>
34
#include <glib.h>
35
49
void
**
array2D_new
(
size_t
row_size,
size_t
col_size,
size_t
element_size,
size_t
pointer_size);
50
56
void
array2D_free
(
void
**arrayPtr);
57
58
65
#define NEW_INSTANCE(type) g_new(type,1)
66
67
75
#define NEW_ARRAY_INSTANCE(element_count,element_type) g_new(element_type,element_count)
76
85
#define NEW_ARRAY2D_INSTANCE(row_size,col_size,element_type) (element_type**) array2D_new(row_size,col_size,sizeof(element_type),sizeof(element_type*));
86
87
#endif
/*ALLOCATE_UTILS_H_*/
array2D_free
void array2D_free(void **arrayPtr)
Free the 2D array create by NEW_ARRAY2D_INSTANCE()
array2D_new
void ** array2D_new(size_t row_size, size_t col_size, size_t element_size, size_t pointer_size)
Allocate a new two dimension array.
Generated by
1.8.9.1