_h5_calloc added

This commit is contained in:
2009-07-16 08:39:35 +00:00
parent f70dce9acc
commit 92adaf3509
2 changed files with 27 additions and 1 deletions
+20 -1
View File
@@ -8,7 +8,8 @@ void *
_h5_alloc (
h5_file_t * const f,
void *ptr,
const size_t size ) {
const size_t size
) {
h5_debug ( f, "Allocating %ld bytes.", size );
ptr = realloc ( ptr, size );
if ( ptr == NULL ) {
@@ -21,6 +22,24 @@ _h5_alloc (
return ptr;
}
void *
_h5_calloc (
h5_file_t * const f,
const size_t count,
const size_t size
) {
h5_debug ( f, "Allocating %ld * %ld bytes.", count, size );
void *ptr = calloc ( count, size );
if ( ptr == NULL ) {
h5_error (
f,
H5_ERR_NOMEM,
"Out of memory." );
return (void*)(H5_ERR);
}
return ptr;
}
h5_err_t
_h5_free (
h5_file_t * const f,
+7
View File
@@ -8,6 +8,13 @@ _h5_alloc (
const size_t size
);
void *
_h5_calloc (
h5_file_t * const f,
const size_t count,
const size_t size
);
h5_err_t
_h5_free (
h5_file_t * const f,