summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Wendling <wendling@ncsa.uiuc.edu>2001-06-19 21:49:01 (GMT)
committerBill Wendling <wendling@ncsa.uiuc.edu>2001-06-19 21:49:01 (GMT)
commit1fdcafdc893c22fd61b85b22c4b53c76a9090fd1 (patch)
tree5593a43ac8c9e363bdb31b45b7f159da9e42a4e1
parent09676ded1f6e9480e5154c8dcdf6a0226755d28b (diff)
downloadhdf5-1fdcafdc893c22fd61b85b22c4b53c76a9090fd1.zip
hdf5-1fdcafdc893c22fd61b85b22c4b53c76a9090fd1.tar.gz
hdf5-1fdcafdc893c22fd61b85b22c4b53c76a9090fd1.tar.bz2
[svn-r4022] Purpose:
Code Cleanup Description: Changed POSIX function calls to the HD* way of doing things. Checked with checkposix and tested on Linux. Platforms tested: Linux
-rw-r--r--src/H5Distore.c22
-rw-r--r--src/H5E.c20
-rw-r--r--src/H5F.c2
-rw-r--r--src/H5Fistore.c22
-rw-r--r--src/H5G.c2
-rw-r--r--src/H5HG.c2
-rw-r--r--src/H5Omtime.c36
-rw-r--r--src/H5Smpio.c18
-rw-r--r--src/H5T.c6
-rw-r--r--src/H5private.h1
10 files changed, 65 insertions, 66 deletions
diff --git a/src/H5Distore.c b/src/H5Distore.c
index 44414f3..4ba52f4 100644
--- a/src/H5Distore.c
+++ b/src/H5Distore.c
@@ -873,7 +873,7 @@ H5F_istore_iterate (H5F_t UNUSED *f, void *_lt_key, haddr_t UNUSED addr,
for (u=0; u<bt_udata->mesg.ndims; u++) {
HDfprintf(bt_udata->stream, "%s%Hd", u?", ":"", lt_key->offset[u]);
}
- fputs("]\n", bt_udata->stream);
+ HDfputs("]\n", bt_udata->stream);
}
bt_udata->total_storage += lt_key->nbytes;
@@ -1175,8 +1175,8 @@ H5F_istore_dest (H5F_t *f)
for (ent=rdcc->head; ent; ent=next) {
#ifdef H5F_ISTORE_DEBUG
- fputc('c', stderr);
- fflush(stderr);
+ HDfputc('c', stderr);
+ HDfflush(stderr);
#endif
next = ent->next;
if (H5F_istore_preempt(f, ent)<0) {
@@ -1258,8 +1258,8 @@ H5F_istore_prune (H5F_t *f, size_t size)
*/
cur = p[0];
#ifdef H5F_ISTORE_DEBUG
- putc('.', stderr);
- fflush(stderr);
+ HDputc('.', stderr);
+ HDfflush(stderr);
#endif
} else if (1==i && p[1] && !p[1]->locked) {
@@ -1270,8 +1270,8 @@ H5F_istore_prune (H5F_t *f, size_t size)
*/
cur = p[1];
#ifdef H5F_ISTORE_DEBUG
- putc(':', stderr);
- fflush(stderr);
+ HDputc(':', stderr);
+ HDfflush(stderr);
#endif
} else {
@@ -1387,8 +1387,8 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout,
* miss because we saved ourselves lots of work.
*/
#ifdef H5F_ISTORE_DEBUG
- putc('w', stderr);
- fflush(stderr);
+ HDputc('w', stderr);
+ HDfflush(stderr);
#endif
rdcc->nhits++;
for (u=0, chunk_size=1; u<layout->ndims; u++) {
@@ -1461,8 +1461,8 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout,
*/
if (ent) {
#ifdef H5F_ISTORE_DEBUG
- putc('#', stderr);
- fflush(stderr);
+ HDputc('#', stderr);
+ HDfflush(stderr);
#endif
#if 0
HDfprintf(stderr, "\ncollision %3d %10a {",
diff --git a/src/H5E.c b/src/H5E.c
index 33577be..64b908d 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -193,19 +193,19 @@ void *H5E_auto_data_g = NULL;
*
*-------------------------------------------------------------------------
*/
-H5E_t *H5E_get_stack() {
- H5E_t *estack;
+H5E_t *H5E_get_stack(void)
+{
+ H5E_t *estack = pthread_getspecific(H5TS_errstk_key_g);
+
+ if (!estack) {
+ /* no associated value with current thread - create one */
+ estack = (H5E_t *)H5MM_malloc(sizeof(H5E_t));
+ pthread_setspecific(H5TS_errstk_key_g, (void *)estack);
+ }
- if ((estack = pthread_getspecific(H5TS_errstk_key_g))!=NULL) {
- return estack;
- } else {
- /* no associated value with current thread - create one */
- estack = (H5E_t *)malloc(sizeof(H5E_t));
- pthread_setspecific(H5TS_errstk_key_g, (void *)estack);
return estack;
- }
}
-#endif
+#endif /* H5_HAVE_THREADSAFE */
/*-------------------------------------------------------------------------
diff --git a/src/H5F.c b/src/H5F.c
index 9389e65..36f9506 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -1236,7 +1236,7 @@ H5F_open(const char *name, uintn flags, hid_t fcpl_id, hid_t fapl_id)
UINT32DECODE(p, driver_size);
/* Driver name and/or version */
- strncpy(driver_name, (const char *)p, 8);
+ HDstrncpy(driver_name, (const char *)p, 8);
driver_name[8] = '\0';
/* Read driver information and decode */
diff --git a/src/H5Fistore.c b/src/H5Fistore.c
index 44414f3..4ba52f4 100644
--- a/src/H5Fistore.c
+++ b/src/H5Fistore.c
@@ -873,7 +873,7 @@ H5F_istore_iterate (H5F_t UNUSED *f, void *_lt_key, haddr_t UNUSED addr,
for (u=0; u<bt_udata->mesg.ndims; u++) {
HDfprintf(bt_udata->stream, "%s%Hd", u?", ":"", lt_key->offset[u]);
}
- fputs("]\n", bt_udata->stream);
+ HDfputs("]\n", bt_udata->stream);
}
bt_udata->total_storage += lt_key->nbytes;
@@ -1175,8 +1175,8 @@ H5F_istore_dest (H5F_t *f)
for (ent=rdcc->head; ent; ent=next) {
#ifdef H5F_ISTORE_DEBUG
- fputc('c', stderr);
- fflush(stderr);
+ HDfputc('c', stderr);
+ HDfflush(stderr);
#endif
next = ent->next;
if (H5F_istore_preempt(f, ent)<0) {
@@ -1258,8 +1258,8 @@ H5F_istore_prune (H5F_t *f, size_t size)
*/
cur = p[0];
#ifdef H5F_ISTORE_DEBUG
- putc('.', stderr);
- fflush(stderr);
+ HDputc('.', stderr);
+ HDfflush(stderr);
#endif
} else if (1==i && p[1] && !p[1]->locked) {
@@ -1270,8 +1270,8 @@ H5F_istore_prune (H5F_t *f, size_t size)
*/
cur = p[1];
#ifdef H5F_ISTORE_DEBUG
- putc(':', stderr);
- fflush(stderr);
+ HDputc(':', stderr);
+ HDfflush(stderr);
#endif
} else {
@@ -1387,8 +1387,8 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout,
* miss because we saved ourselves lots of work.
*/
#ifdef H5F_ISTORE_DEBUG
- putc('w', stderr);
- fflush(stderr);
+ HDputc('w', stderr);
+ HDfflush(stderr);
#endif
rdcc->nhits++;
for (u=0, chunk_size=1; u<layout->ndims; u++) {
@@ -1461,8 +1461,8 @@ H5F_istore_lock(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout,
*/
if (ent) {
#ifdef H5F_ISTORE_DEBUG
- putc('#', stderr);
- fflush(stderr);
+ HDputc('#', stderr);
+ HDfflush(stderr);
#endif
#if 0
HDfprintf(stderr, "\ncollision %3d %10a {",
diff --git a/src/H5G.c b/src/H5G.c
index ffa9021..412bce8 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -902,7 +902,7 @@ H5G_basename(const char *name, size_t *size_p)
FUNC_ENTER(H5G_basename, NULL);
/* Find the end of the base name */
- i = strlen(name);
+ i = HDstrlen(name);
while (i>0 && '/'==name[i-1]) --i;
/* Skip backward over base name */
diff --git a/src/H5HG.c b/src/H5HG.c
index b57b08f..a51632d 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -162,7 +162,7 @@ printf("%s: size=%d\n",FUNC,(int)size);
* align the pointer, but this might not be the case.
*/
n = H5HG_ALIGN(p-heap->chunk) - (p-heap->chunk);
- memset(p, 0, n);
+ HDmemset(p, 0, n);
p += n;
/* The freespace object */
diff --git a/src/H5Omtime.c b/src/H5Omtime.c
index 316ce38..2069a59 100644
--- a/src/H5Omtime.c
+++ b/src/H5Omtime.c
@@ -129,35 +129,33 @@ H5O_mtime_decode(H5F_t UNUSED *f, const uint8_t *p,
#elif defined(H5_HAVE_BSDGETTIMEOFDAY) && defined(H5_HAVE_STRUCT_TIMEZONE)
/* Irix5.3 */
{
- struct timezone tz;
- if (BSDgettimeofday(NULL, &tz)<0) {
- HRETURN_ERROR(H5E_OHDR, H5E_CANTINIT, NULL,
- "unable to obtain local timezone information");
- }
- the_time -= tz.tz_minuteswest*60 - (tm.tm_isdst?3600:0);
+ struct timezone tz;
+ if (HDBSDgettimeofday(NULL, &tz)<0) {
+ HRETURN_ERROR(H5E_OHDR, H5E_CANTINIT, NULL,
+ "unable to obtain local timezone information");
+ }
+ the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0);
}
#elif defined(H5_HAVE_GETTIMEOFDAY) && defined(H5_HAVE_STRUCT_TIMEZONE)
{
struct timezone tz;
- if (gettimeofday(NULL, &tz)<0) {
+
+ if (HDgettimeofday(NULL, &tz) < 0) {
HRETURN_ERROR(H5E_OHDR, H5E_CANTINIT, NULL,
"unable to obtain local timezone information");
}
- the_time -= tz.tz_minuteswest*60 - (tm.tm_isdst?3600:0);
+
+ the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0);
}
#elif defined (WIN32) && !defined (__MWERKS__)
- {
-
- struct timeb timebuffer;
- long tz;
- ftime( &timebuffer );
-
- tz = timebuffer.timezone;
-
- the_time -=tz*60-3600*_daylight;
+ {
+ struct timeb timebuffer;
+ long tz;
-
-}
+ ftime(&timebuffer);
+ tz = timebuffer.timezone;
+ the_time -= tz * 60 - 3600 * _daylight;
+ }
#else
/*
* The catch-all. If we can't convert a character string universal
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index f459719..2a41d3f 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -108,7 +108,7 @@ H5S_mpio_all_type( const H5S_t *space, const size_t elmt_size,
*is_derived_type = 0;
#ifdef H5Smpi_DEBUG
- fprintf(stdout, "Leave %s total_bytes=%Hu\n", FUNC, total_bytes );
+ HDfprintf(stdout, "Leave %s total_bytes=%Hu\n", FUNC, total_bytes );
#endif
FUNC_LEAVE (SUCCEED);
}
@@ -185,8 +185,8 @@ H5S_mpio_hyper_type( const H5S_t *space, const size_t elmt_size,
HDfprintf(stdout, "hyper_type: start=%Hd stride=%Hu count=%Hu "
"block=%Hu xtent=%Hu",
d[i].start, d[i].strid, d[i].count, d[i].block, d[i].xtent );
- if (i==0) fprintf(stdout, " rank=%d\n", rank );
- else fprintf(stdout, "\n" );
+ if (i==0) HDfprintf(stdout, " rank=%d\n", rank );
+ else HDfprintf(stdout, "\n" );
#endif
if (0==d[i].block) goto empty;
if (0==d[i].count) goto empty;
@@ -201,14 +201,14 @@ H5S_mpio_hyper_type( const H5S_t *space, const size_t elmt_size,
max_xtent[rank-1] = d[rank-1].xtent;
#ifdef H5Smpi_DEBUG
i=rank-1;
- fprintf(stdout, " offset[%2d]=%d; max_xtent[%2d]=%d\n",
+ HDfprintf(stdout, " offset[%2d]=%d; max_xtent[%2d]=%d\n",
i, offset[i], i, max_xtent[i]);
#endif
for (i=rank-2; i>=0; --i) {
offset[i] = offset[i+1]*d[i+1].xtent;
max_xtent[i] = max_xtent[i+1]*d[i].xtent;
#ifdef H5Smpi_DEBUG
- fprintf(stdout, " offset[%2d]=%d; max_xtent[%2d]=%d\n",
+ HDfprintf(stdout, " offset[%2d]=%d; max_xtent[%2d]=%d\n",
i, offset[i], i, max_xtent[i]);
#endif
}
@@ -252,8 +252,8 @@ H5S_mpio_hyper_type( const H5S_t *space, const size_t elmt_size,
assert(0<=num_to_collapse && num_to_collapse<rank);
new_rank = rank - num_to_collapse;
#ifdef H5Smpi_DEBUG
- fprintf(stdout, "num_to_collapse=%d\n", num_to_collapse);
- fprintf(stdout, "hyper_type: new_rank=%d\n", new_rank );
+ HDfprintf(stdout, "num_to_collapse=%d\n", num_to_collapse);
+ HDfprintf(stdout, "hyper_type: new_rank=%d\n", new_rank );
#endif
/* To collapse dims, just transform dimension info (from inner to outer) */
@@ -280,7 +280,7 @@ H5S_mpio_hyper_type( const H5S_t *space, const size_t elmt_size,
* Construct contig type for inner contig dims:
*******************************************************/
#ifdef H5Smpi_DEBUG
- fprintf(stdout, "hyper_type: Making contig type %d MPI_BYTEs\n", elmt_size );
+ HDfprintf(stdout, "hyper_type: Making contig type %d MPI_BYTEs\n", elmt_size );
for (i=new_rank-1; i>=0; --i) {
HDfprintf(stdout, "d[%d].xtent=%Hu \n", i, d[i].xtent);
}
@@ -582,7 +582,7 @@ H5S_mpio_spaces_xfer(H5F_t *f, const struct H5O_layout_t *layout,
if (layout->type != H5D_CONTIGUOUS) {
#ifdef H5S_DEBUG
if (H5DEBUG(S)) {
- fprintf (H5DEBUG(S), "H5S: can only create MPI datatype for hyperslab when layout is contiguous.\n" );
+ HDfprintf (H5DEBUG(S), "H5S: can only create MPI datatype for hyperslab when layout is contiguous.\n" );
}
#endif
*must_convert = 1; /* can't do optimized xfer; do the old way */
diff --git a/src/H5T.c b/src/H5T.c
index 7501990..91f7529 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -6221,7 +6221,7 @@ H5T_enum_nameof(H5T_t *dt, void *value, char *name/*out*/, size_t size)
}
/* Save result name */
- if (!name && NULL==(name=H5MM_malloc(strlen(dt->u.enumer.name[md])+1))) {
+ if (!name && NULL==(name=H5MM_malloc(HDstrlen(dt->u.enumer.name[md])+1))) {
HRETURN_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL,
"memory allocation failed");
}
@@ -6805,10 +6805,10 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name,
"memory allocation failed for type conversion path");
}
if (name && *name) {
- strncpy(path->name, name, H5T_NAMELEN);
+ HDstrncpy(path->name, name, H5T_NAMELEN);
path->name[H5T_NAMELEN-1] = '\0';
} else {
- strcpy(path->name, "NONAME");
+ HDstrcpy(path->name, "NONAME");
}
if ((src && NULL==(path->src=H5T_copy(src, H5T_COPY_ALL))) ||
(dst && NULL==(path->dst=H5T_copy(dst, H5T_COPY_ALL)))) {
diff --git a/src/H5private.h b/src/H5private.h
index 7bc4083..12bca56 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -506,6 +506,7 @@ __DLL__ void H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds);
#define HDatof(S) atof(S)
#define HDatoi(S) atoi(S)
#define HDatol(S) atol(S)
+#define HDBSDgettimeofday(S,P) BSDgettimeofday(S,P)
#define HDbsearch(K,B,N,Z,F) bsearch(K,B,N,Z,F)
#define HDcalloc(N,Z) calloc(N,Z)
#define HDceil(X) ceil(X)