mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
moved function
This commit is contained in:
parent
ad592448df
commit
4213f10ed6
@ -142,52 +142,6 @@ sync_netcdf4_file(NC_FILE_INFO_T *h5)
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal Output a list of still-open objects in the HDF5
|
||||
* file. This is only called if the file fails to close cleanly.
|
||||
*
|
||||
* @param h5 Pointer to file info.
|
||||
*
|
||||
* @author Dennis Heimbigner
|
||||
*/
|
||||
static void
|
||||
dumpopenobjects(NC_FILE_INFO_T* h5)
|
||||
{
|
||||
NC_HDF5_FILE_INFO_T *hdf5_info;
|
||||
int nobjs;
|
||||
|
||||
assert(h5 && h5->format_file_info);
|
||||
hdf5_info = (NC_HDF5_FILE_INFO_T *)h5->format_file_info;
|
||||
|
||||
nobjs = H5Fget_obj_count(hdf5_info->hdfid, H5F_OBJ_ALL);
|
||||
|
||||
/* Apparently we can get an error even when nobjs == 0 */
|
||||
if(nobjs < 0) {
|
||||
return;
|
||||
} else if(nobjs > 0) {
|
||||
char msg[1024];
|
||||
int logit = 0;
|
||||
/* If the close doesn't work, probably there are still some HDF5
|
||||
* objects open, which means there's a bug in the library. So
|
||||
* print out some info on to help the poor programmer figure it
|
||||
* out. */
|
||||
snprintf(msg,sizeof(msg),"There are %d HDF5 objects open!", nobjs);
|
||||
#ifdef LOGGING
|
||||
#ifdef LOGOPEN
|
||||
LOG((0, msg));
|
||||
logit = 1;
|
||||
#endif
|
||||
#else
|
||||
fprintf(stdout,"%s\n",msg);
|
||||
logit = 0;
|
||||
#endif
|
||||
reportopenobjects(logit,hdf5_info->hdfid);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal This function will free all allocated metadata memory,
|
||||
* and close the HDF5 file.
|
||||
@ -279,6 +233,52 @@ nc4_close_netcdf4_file(NC_FILE_INFO_T *h5, int abort, int extractmem)
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal Output a list of still-open objects in the HDF5
|
||||
* file. This is only called if the file fails to close cleanly.
|
||||
*
|
||||
* @param h5 Pointer to file info.
|
||||
*
|
||||
* @author Dennis Heimbigner
|
||||
*/
|
||||
static void
|
||||
dumpopenobjects(NC_FILE_INFO_T* h5)
|
||||
{
|
||||
NC_HDF5_FILE_INFO_T *hdf5_info;
|
||||
int nobjs;
|
||||
|
||||
assert(h5 && h5->format_file_info);
|
||||
hdf5_info = (NC_HDF5_FILE_INFO_T *)h5->format_file_info;
|
||||
|
||||
nobjs = H5Fget_obj_count(hdf5_info->hdfid, H5F_OBJ_ALL);
|
||||
|
||||
/* Apparently we can get an error even when nobjs == 0 */
|
||||
if(nobjs < 0) {
|
||||
return;
|
||||
} else if(nobjs > 0) {
|
||||
char msg[1024];
|
||||
int logit = 0;
|
||||
/* If the close doesn't work, probably there are still some HDF5
|
||||
* objects open, which means there's a bug in the library. So
|
||||
* print out some info on to help the poor programmer figure it
|
||||
* out. */
|
||||
snprintf(msg,sizeof(msg),"There are %d HDF5 objects open!", nobjs);
|
||||
#ifdef LOGGING
|
||||
#ifdef LOGOPEN
|
||||
LOG((0, msg));
|
||||
logit = 1;
|
||||
#endif
|
||||
#else
|
||||
fprintf(stdout,"%s\n",msg);
|
||||
logit = 0;
|
||||
#endif
|
||||
reportopenobjects(logit,hdf5_info->hdfid);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set chunk cache size. Only affects files opened/created *after* it
|
||||
* is called.
|
||||
|
Loading…
Reference in New Issue
Block a user