summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>1999-07-23 21:20:07 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>1999-07-23 21:20:07 (GMT)
commitff6bfe4a2f84d3acbd3d325a80a9d0f8bfae634f (patch)
tree342f34ac331e13432b4e6de0e9b4cad991602984 /test
parenta5d799d351d461da8506f2b7a4d4723ff30885cf (diff)
downloadhdf5-ff6bfe4a2f84d3acbd3d325a80a9d0f8bfae634f.zip
hdf5-ff6bfe4a2f84d3acbd3d325a80a9d0f8bfae634f.tar.gz
hdf5-ff6bfe4a2f84d3acbd3d325a80a9d0f8bfae634f.tar.bz2
[svn-r1536] Fixed alignment problems on DEC Alpha platform.
Diffstat (limited to 'test')
-rw-r--r--test/tvltypes.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/test/tvltypes.c b/test/tvltypes.c
index be1ada0..019bdfc 100644
--- a/test/tvltypes.c
+++ b/test/tvltypes.c
@@ -56,12 +56,19 @@ void *test_vltypes_alloc_custom(size_t size, void *info)
{
void *ret_value=NULL; /* Pointer to return */
int *mem_used=(int *)info; /* Get the pointer to the memory used */
+ size_t extra; /* Extra space needed */
- if((ret_value=HDmalloc(sizeof(int)+size))!=NULL) {
+ /*
+ * This weird contortion is required on the DEC Alpha to keep the
+ * alignment correct - QAK
+ */
+ extra=MAX(sizeof(void *),sizeof(int));
+
+ if((ret_value=HDmalloc(extra+size))!=NULL) {
*(int *)ret_value=size;
*mem_used+=size;
} /* end if */
- ret_value=((unsigned char *)ret_value)+sizeof(int);
+ ret_value=((unsigned char *)ret_value)+extra;
return(ret_value);
}
@@ -77,9 +84,16 @@ void test_vltypes_free_custom(void *_mem, void *info)
{
unsigned char *mem;
int *mem_used=(int *)info; /* Get the pointer to the memory used */
+ size_t extra; /* Extra space needed */
+
+ /*
+ * This weird contortion is required on the DEC Alpha to keep the
+ * alignment correct - QAK
+ */
+ extra=MAX(sizeof(void *),sizeof(int));
if(_mem!=NULL) {
- mem=((unsigned char *)_mem)-sizeof(int);
+ mem=((unsigned char *)_mem)-extra;
*mem_used-=*(int *)mem;
HDfree(mem);
} /* end if */