summaryrefslogtreecommitdiffstats
path: root/src/H5MM.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-05-22 15:05:53 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-05-22 15:05:53 (GMT)
commitd392756a1b6e28ff5a28e80c5c26513e8ef54e69 (patch)
tree00479cc9a7baba6c7e8e68d375f79221729751d4 /src/H5MM.c
parent57e57ebb14aa3f5a88245965292031f25dfc7756 (diff)
downloadhdf5-d392756a1b6e28ff5a28e80c5c26513e8ef54e69.zip
hdf5-d392756a1b6e28ff5a28e80c5c26513e8ef54e69.tar.gz
hdf5-d392756a1b6e28ff5a28e80c5c26513e8ef54e69.tar.bz2
[svn-r400] Changes since 19980513
---------------------- ./html/Datasets.html Fixed a couple of typos. ./src/H5.c Added the `Z' modifier to HDfprintf() for `size_t' sizes. Use it like this: HDfprintf(stderr,"size is %Zd\n", (size_t)x); ./src/H5AC.c ./src/H5F.c ./src/H5Fprivate.h The maximum number of meta data objects that can be cached can be set from the application (but the library might not honor it every time; it's a hint). ./src/H5D.c Changed a warning message so it's not so alarming. ./src/H5Fistore.c Chunks can be cached. ./src/H5O.c ./src/H5Oprivate.h Added H5O_copy() and H5O_free() to copy and free messages. ./src/H5P.c ./src/H5Ppublic.h Added H5Pset_cache() and H5Pget_cache() and changed lots of "template" to "property list". ./src/H5Z.c ./src/H5Zpublic.h Miscellaneous little things to clean up. Mostly just removed H5Z_MAXVAL and added H5Z_USERDEF_MIN and H5Z_USERDEF_MAX. ./MANIFEST ./test/Makefile.in ./test/chunk.c [NEW] Added a performance test for chunk caching. It looks at the amount of I/O instead of timing because timing is partly dependent on the chunk size and I wanted a measurement that was a function of only the cache size. Run `chunk' with no arguments and then say `gnuplot x-gnuplot' to see the plots (press return between plots). Postscript files are created for each plot. ./test/big.c ./test/cmpd_dset.c ./test/extend.c ./test/external.c ./test/gheap.c Added H5F_ACC_DEBUG so we can see cache performance statistics.
Diffstat (limited to 'src/H5MM.c')
-rw-r--r--src/H5MM.c130
1 files changed, 67 insertions, 63 deletions
diff --git a/src/H5MM.c b/src/H5MM.c
index 329a4f0..5a02f41 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -1,59 +1,61 @@
/*-------------------------------------------------------------------------
- * Copyright (C) 1997 National Center for Supercomputing Applications.
- * All rights reserved.
+ * Copyright (C) 1997 National Center for Supercomputing Applications.
+ * All rights reserved.
*
*-------------------------------------------------------------------------
*
- * Created: H5MM.c
- * Jul 10 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Created: H5MM.c
+ * Jul 10 1997
+ * Robb Matzke <matzke@llnl.gov>
*
- * Purpose: Memory management functions.
+ * Purpose: Memory management functions.
*
- * Modifications:
+ * Modifications:
*
*-------------------------------------------------------------------------
*/
#include <H5private.h>
#include <H5MMprivate.h>
+
/*-------------------------------------------------------------------------
- * Function: H5MM_xmalloc
+ * Function: H5MM_xmalloc
*
- * Purpose: Just like malloc(3) except it aborts on an error.
+ * Purpose: Just like malloc(3) except it aborts on an error.
*
- * Return: Success: Ptr to new memory.
+ * Return: Success: Ptr to new memory.
*
- * Failure: abort()
+ * Failure: abort()
*
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jul 10 1997
+ * Programmer: Robb Matzke
+ * matzke@llnl.gov
+ * Jul 10 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
-void *
+void *
H5MM_xmalloc(size_t size)
{
- void *mem = HDmalloc(size);
+ void *mem = HDmalloc(size);
assert(mem);
return mem;
}
+
/*-------------------------------------------------------------------------
- * Function: H5MM_xcalloc
+ * Function: H5MM_xcalloc
*
- * Purpose: Just like calloc(3) except it aborts on an error.
+ * Purpose: Just like calloc(3) except it aborts on an error.
*
- * Return: Success: Ptr to memory.
+ * Return: Success: Ptr to memory.
*
- * Failure: abort()
+ * Failure: abort()
*
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jul 10 1997
+ * Programmer: Robb Matzke
+ * matzke@llnl.gov
+ * Jul 10 1997
*
* Modifications:
*
@@ -73,64 +75,65 @@ H5MM_xcalloc(intn n, size_t size)
return mem;
}
+
/*-------------------------------------------------------------------------
- * Function: H5MM_xrealloc
+ * Function: H5MM_xrealloc
*
- * Purpose: Just like the POSIX version of realloc(3) exept it aborts
- * on an error. Specifically, the following calls are
- * equivalent
+ * Purpose: Just like the POSIX version of realloc(3) exept it aborts
+ * on an error. Specifically, the following calls are
+ * equivalent
*
- * H5MM_xrealloc (NULL, size) <==> H5MM_xmalloc (size)
- * H5MM_xrealloc (ptr, 0) <==> H5MM_xfree (ptr)
- * H5MM_xrealloc (NULL, 0) <==> NULL
+ * H5MM_xrealloc (NULL, size) <==> H5MM_xmalloc (size)
+ * H5MM_xrealloc (ptr, 0) <==> H5MM_xfree (ptr)
+ * H5MM_xrealloc (NULL, 0) <==> NULL
*
- * Return: Success: Ptr to new memory or NULL if the memory
- * was freed.
+ * Return: Success: Ptr to new memory or NULL if the memory
+ * was freed.
*
- * Failure: abort()
+ * Failure: abort()
*
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jul 10 1997
+ * Programmer: Robb Matzke
+ * matzke@llnl.gov
+ * Jul 10 1997
*
* Modifications:
*
*-------------------------------------------------------------------------
*/
-void *
+void *
H5MM_xrealloc(void *mem, size_t size)
{
if (!mem) {
- if (0 == size)
- return NULL;
- mem = H5MM_xmalloc(size);
+ if (0 == size) return NULL;
+ mem = H5MM_xmalloc(size);
} else if (0 == size) {
- mem = H5MM_xfree(mem);
+ mem = H5MM_xfree(mem);
} else {
- mem = HDrealloc(mem, size);
- assert(mem);
+ mem = HDrealloc(mem, size);
+ assert(mem);
}
return mem;
}
+
/*-------------------------------------------------------------------------
- * Function: H5MM_strdup
+ * Function: H5MM_strdup
*
- * Purpose: Duplicates a string. If the string to be duplicated is the
- * null pointer, then return null. If the string to be duplicated
- * is the empty string then return a new empty string.
+ * Purpose: Duplicates a string. If the string to be duplicated is the
+ * null pointer, then return null. If the string to be duplicated
+ * is the empty string then return a new empty string.
*
- * Return: Success: Ptr to a new string (or null if no string).
+ * Return: Success: Ptr to a new string (or null if no string).
*
- * Failure: abort()
+ * Failure: abort()
*
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jul 10 1997
+ * Programmer: Robb Matzke
+ * matzke@llnl.gov
+ * Jul 10 1997
*
* Modifications:
*
@@ -139,30 +142,31 @@ H5MM_xrealloc(void *mem, size_t size)
char *
H5MM_xstrdup(const char *s)
{
- char *mem;
+ char *mem;
if (!s) return NULL;
mem = H5MM_xmalloc(HDstrlen(s) + 1);
HDstrcpy(mem, s);
return mem;
}
+
/*-------------------------------------------------------------------------
- * Function: H5MM_xfree
+ * Function: H5MM_xfree
*
- * Purpose: Just like free(3) except null pointers are allowed as
- * arguments, and the return value (always NULL) can be
- * assigned to the pointer whose memory was just freed:
+ * Purpose: Just like free(3) except null pointers are allowed as
+ * arguments, and the return value (always NULL) can be
+ * assigned to the pointer whose memory was just freed:
*
- * thing = H5MM_xfree (thing);
+ * thing = H5MM_xfree (thing);
*
- * Return: Success: NULL
+ * Return: Success: NULL
*
- * Failure: never fails
+ * Failure: never fails
*
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Jul 10 1997
+ * Programmer: Robb Matzke
+ * matzke@llnl.gov
+ * Jul 10 1997
*
* Modifications:
*