diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-08-24 00:33:09 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-08-24 00:33:09 (GMT) |
commit | e5d9761abad0b613eaa99b7bbced6cad20e917bd (patch) | |
tree | 44ea85c659cb25f3f1a93392f1d703953120461a /src/H5Omtime.c | |
parent | 3de1ecd9c8f376523f4d4fe5a5c2f265e246bdde (diff) | |
download | hdf5-e5d9761abad0b613eaa99b7bbced6cad20e917bd.zip hdf5-e5d9761abad0b613eaa99b7bbced6cad20e917bd.tar.gz hdf5-e5d9761abad0b613eaa99b7bbced6cad20e917bd.tar.bz2 |
[svn-r19283] Description:
Bring r19278 from trunk to 1.8 branch:
More fixes to memory allocation, etc. exposed by valgrind.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.4 (amazon) in debug mode
Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
Diffstat (limited to 'src/H5Omtime.c')
-rw-r--r-- | src/H5Omtime.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/H5Omtime.c b/src/H5Omtime.c index e71fb50..731d833 100644 --- a/src/H5Omtime.c +++ b/src/H5Omtime.c @@ -96,7 +96,7 @@ const H5O_msg_class_t H5O_MSG_MTIME_NEW[1] = {{ #define H5O_MTIME_VERSION 1 /* Track whether tzset routine was called */ -static int ntzset=0; +static hbool_t ntzset = FALSE; /* Declare a free list to manage the time_t struct */ H5FL_DEFINE(time_t); @@ -180,23 +180,22 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, struct tm tm; void *ret_value; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5O_mtime_decode); + FUNC_ENTER_NOAPI_NOINIT(H5O_mtime_decode) /* check args */ - assert(f); - assert(p); + HDassert(f); + HDassert(p); /* Initialize time zone information */ - if (!ntzset) { + if(!ntzset) { HDtzset(); - ntzset=1; + ntzset = TRUE; } /* end if */ /* decode */ - for (i=0; i<14; i++) { - if (!HDisdigit(p[i])) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message"); - } + for(i = 0; i < 14; i++) + if(!HDisdigit(p[i])) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message") /* * Convert YYYYMMDDhhmmss UTC to a time_t. This is a little problematic @@ -213,8 +212,8 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, tm.tm_min = (p[10]-'0')*10 + (p[11]-'0'); tm.tm_sec = (p[12]-'0')*10 + (p[13]-'0'); tm.tm_isdst = -1; /*figure it out*/ - if ((time_t)-1==(the_time=HDmktime(&tm))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message"); + if((time_t)-1 == (the_time = HDmktime(&tm))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message") #if defined(H5_HAVE_TM_GMTOFF) /* FreeBSD, OSF 4.0 */ @@ -230,8 +229,8 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, { struct timezone tz; - if (HDBSDgettimeofday(NULL, &tz)<0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information"); + if(HDBSDgettimeofday(NULL, &tz) < 0) + HGOTO_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) && defined(H5_GETTIMEOFDAY_GIVES_TZ) @@ -239,8 +238,8 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, struct timezone tz; struct timeval tv; /* Used as a placebo; some systems don't like NULL */ - if (HDgettimeofday(&tv, &tz) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information"); + if(HDgettimeofday(&tv, &tz) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information") the_time -= tz.tz_minuteswest * 60 - (tm.tm_isdst ? 3600 : 0); } @@ -254,20 +253,20 @@ H5O_mtime_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh, */ /* Irix64 */ - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information"); + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to obtain local timezone information") #endif /* The return value */ - if (NULL==(mesg = H5FL_MALLOC(time_t))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + if(NULL == (mesg = H5FL_MALLOC(time_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") *mesg = the_time; /* Set return value */ - ret_value=mesg; + ret_value = mesg; done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O_mtime_decode() */ /*------------------------------------------------------------------------- |