Skip to content

Commit

Permalink
Remove dead code behind #ifdef OLD_WAY (#3163)
Browse files Browse the repository at this point in the history
  • Loading branch information
derobins authored Jun 21, 2023
1 parent 94ea835 commit 56513d9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 79 deletions.
14 changes: 5 additions & 9 deletions src/H5B2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
18 changes: 0 additions & 18 deletions src/H5Dio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
16 changes: 1 addition & 15 deletions src/H5HG.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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)
Expand Down Expand Up @@ -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 */
Expand Down
40 changes: 3 additions & 37 deletions test/h5test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 */
}

/*-------------------------------------------------------------------------
Expand Down

0 comments on commit 56513d9

Please sign in to comment.