From ecf12969d2e553fa223430003d9226cd424ec34f Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 20 Jun 2023 16:59:53 -0700 Subject: [PATCH] Remove dead code behind #ifdef OLD_WAY --- src/H5B2.c | 14 +++++--------- src/H5Dio.c | 18 ------------------ src/H5HG.c | 16 +--------------- test/h5test.c | 40 +++------------------------------------- 4 files changed, 9 insertions(+), 79 deletions(-) diff --git a/src/H5B2.c b/src/H5B2.c index a51de6c612b..093f8ee981d 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -1317,16 +1317,12 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data) if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") - /* Note: don't push error on stack, leave that to next higher level, - * since many times the B-tree is searched in order to determine - * if an object exists in the B-tree or not. -QAK - */ -#ifdef OLD_WAY - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "key not found in leaf node") -#else /* OLD_WAY */ + /* Note: don't push error on stack, leave that to next higher level, + * since many times the B-tree is searched in order to determine + * if an object exists in the B-tree or not. + */ HGOTO_DONE(FAIL) -#endif /* OLD_WAY */ - } /* end if */ + } else { /* Make callback for current record */ if ((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data, &changed) < 0) { diff --git a/src/H5Dio.c b/src/H5Dio.c index 1cd58353011..69ba3100798 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -827,24 +827,6 @@ H5D__write(size_t count, H5D_dset_io_info_t *dset_info) #endif /* H5_HAVE_PARALLEL */ } -#ifdef OLD_WAY - /* - * This was taken out because it can be called in a parallel program with - * independent access, causing the metadata cache to get corrupted. Its been - * disabled for all types of access (serial as well as parallel) to make the - * modification time consistent for all programs. -QAK - * - * We should set a value in the dataset's shared information instead and flush - * it to the file when the dataset is being closed. -QAK - */ - /* - * Update modification time. We have to do this explicitly because - * writing to a dataset doesn't necessarily change the object header. - */ - if (H5O_touch(&(dataset->oloc), FALSE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time") -#endif /* OLD_WAY */ - done: /* Shut down the I/O op information */ for (i = 0; i < io_op_init; i++) { diff --git a/src/H5HG.c b/src/H5HG.c index c6c3c8dd119..599da94fb85 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -169,10 +169,6 @@ H5HG__create(H5F_t *f, size_t size) * align the pointer, but this might not be the case. */ n = (size_t)H5HG_ALIGN(p - heap->chunk) - (size_t)(p - heap->chunk); -#ifdef OLD_WAY - /* Don't bother zeroing out the rest of the info in the heap -QAK */ - HDmemset(p, 0, n); -#endif /* OLD_WAY */ p += n; /* The freespace object */ @@ -184,10 +180,6 @@ H5HG__create(H5F_t *f, size_t size) UINT16ENCODE(p, 0); /*reference count*/ UINT32ENCODE(p, 0); /*reserved*/ H5F_ENCODE_LENGTH(f, p, heap->obj[0].size); -#ifdef OLD_WAY - /* Don't bother zeroing out the rest of the info in the heap -QAK */ - HDmemset(p, 0, (size_t)((heap->chunk + heap->size) - p)); -#endif /* OLD_WAY */ /* Add this heap to the beginning of the CWFS list */ if (H5F_cwfs_add(f, heap) < 0) @@ -537,14 +529,8 @@ H5HG_insert(H5F_t *f, size_t size, const void *obj, H5HG_t *hobj /*out*/) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate global heap object") /* Copy data into the heap */ - if (size > 0) { + if (size > 0) H5MM_memcpy(heap->obj[idx].begin + H5HG_SIZEOF_OBJHDR(f), obj, size); -#ifdef OLD_WAY - /* Don't bother zeroing out the rest of the info in the heap -QAK */ - HDmemset(heap->obj[idx].begin + H5HG_SIZEOF_OBJHDR(f) + size, 0, - need - (H5HG_SIZEOF_OBJHDR(f) + size)); -#endif /* OLD_WAY */ - } /* end if */ heap_flags |= H5AC__DIRTIED_FLAG; /* Return value */ diff --git a/test/h5test.c b/test/h5test.c index c0e93b9a749..54ff3304d67 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -320,15 +320,11 @@ h5_restore_err(void) } /*------------------------------------------------------------------------- - * Function: h5_reset + * Function: h5_reset * - * Purpose: Reset the library by closing it. - * - * Return: void - * - * Programmer: Robb Matzke - * Friday, November 20, 1998 + * Purpose: Reset the library by closing it * + * Return: void *------------------------------------------------------------------------- */ void @@ -342,36 +338,6 @@ h5_reset(void) HDassert(err_func == NULL); H5Eget_auto2(H5E_DEFAULT, &err_func, NULL); H5Eset_auto2(H5E_DEFAULT, h5_errors, NULL); - -/* - * I commented this chunk of code out because it's not clear what diagnostics - * were being output and under what circumstances, and creating this file - * is throwing off debugging some of the tests. I can't see any _direct_ - * harm in keeping this section of code, but I can't see any _direct_ - * benefit right now either. If we figure out under which circumstances - * diagnostics are being output, we should enable this behavior based on - * appropriate configure flags/macros. QAK - 2007/12/20 - */ -#ifdef OLD_WAY - { - char filename[1024]; - - /* - * Cause the library to emit some diagnostics early so they don't - * interfere with other formatted output. - */ - HDsnprintf(filename, sizeof(filename), "/tmp/h5emit-%05d.h5", HDgetpid()); - H5E_BEGIN_TRY - { - hid_t file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - hid_t grp = H5Gcreate2(file, "emit", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - H5Gclose(grp); - H5Fclose(file); - HDunlink(filename); - } - H5E_END_TRY - } -#endif /* OLD_WAY */ } /*-------------------------------------------------------------------------