summaryrefslogtreecommitdiffstats
path: root/src/H5private.h
diff options
context:
space:
mode:
authorLeon Arber <larber@ncsa.uiuc.edu>2006-03-16 21:35:32 (GMT)
committerLeon Arber <larber@ncsa.uiuc.edu>2006-03-16 21:35:32 (GMT)
commitbac394c4956281bcd5b4f653a152c659b3f5bb9c (patch)
tree1a4c7eee21291119be17d07c00ec5d13e60e8ba0 /src/H5private.h
parent6e8ba9561dff2585c5078a01c4d6db0f790ba1fb (diff)
downloadhdf5-bac394c4956281bcd5b4f653a152c659b3f5bb9c.zip
hdf5-bac394c4956281bcd5b4f653a152c659b3f5bb9c.tar.gz
hdf5-bac394c4956281bcd5b4f653a152c659b3f5bb9c.tar.bz2
[svn-r12110] Purpose:
Optimization Description: Get rid of unnecessary function call for systems that don't have rand_r. Solution: If rand_r isn't present on a system, then macros can be used to simply call the underlying random function instead of calling the HDrand/HDsrand functions that keep track of the random seed within the library. Platforms tested: heping (minor change) Misc. update:
Diffstat (limited to 'src/H5private.h')
-rw-r--r--src/H5private.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/H5private.h b/src/H5private.h
index 96e91eb..b89967d 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -773,8 +773,24 @@ typedef off_t h5_stat_size_t;
#define HDputs(S) puts(S)
#define HDqsort(M,N,Z,F) qsort(M,N,Z,F)
#define HDraise(N) raise(N)
-H5_DLL int HDrand(void);
+
+#ifdef H5_HAVE_RAND_R
#define HDrandom() HDrand()
+#define HDsrandom(S) HDsrand(S)
+H5_DLL int HDrand();
+H5_DLL void HDsrand(unsigned int seed);
+#elif H5_HAVE_RANDOM
+#define HDrand() random()
+#define HDrandom() random()
+#define HDsrandom(S) srandom(S)
+#define HDsrand(S) srandom(S)
+#else
+#define HDrand() rand()
+#define HDrandom() rand()
+#define HDsrandom(S) srand(S)
+#define HDsrand(S) srand(S)
+#endif
+
#define HDread(F,M,Z) read(F,M,Z)
#define HDreaddir(D) readdir(D)
#define HDrealloc(M,Z) realloc(M,Z)