From 766f1d0195c9b9b493287b8350fd3c1f8b616b26 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Mon, 12 Nov 2018 13:43:43 -0700 Subject: [PATCH] hdf5-specific changes for hdf5grp.c --- libhdf5/hdf5grp.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libhdf5/hdf5grp.c b/libhdf5/hdf5grp.c index 08d53fb0b..a924f7a6b 100644 --- a/libhdf5/hdf5grp.c +++ b/libhdf5/hdf5grp.c @@ -91,7 +91,7 @@ NC4_def_grp(int parent_ncid, const char *name, int *new_ncid) int NC4_rename_grp(int grpid, const char *name) { - NC_GRP_INFO_T *grp, *parent; + NC_GRP_INFO_T *grp; NC_HDF5_GRP_INFO_T *hdf5_grp; NC_FILE_INFO_T *h5; char norm_name[NC_MAX_NAME + 1]; @@ -113,7 +113,6 @@ NC4_rename_grp(int grpid, const char *name) /* Do not allow renaming the root group */ if (grp->parent == NULL) return NC_EBADGRPID; - parent = grp->parent; /* Check and normalize the name. */ if ((retval = nc4_check_name(name, norm_name))) @@ -121,7 +120,7 @@ NC4_rename_grp(int grpid, const char *name) /* Check that this name is not in use as a var, grp, or type in the * parent group (i.e. the group that grp is in). */ - if ((retval = nc4_check_dup_name(parent, norm_name))) + if ((retval = nc4_check_dup_name(grp->parent, norm_name))) return retval; /* If it's not in define mode, switch to define mode. */ @@ -130,26 +129,27 @@ NC4_rename_grp(int grpid, const char *name) return retval; /* Rename the group, if it exists in the file */ - if (grp->hdf_grpid) + if (hdf5_grp->hdf_grpid) { NC_HDF5_GRP_INFO_T *parent_hdf5_grp; parent_hdf5_grp = (NC_HDF5_GRP_INFO_T *)grp->parent->format_grp_info; /* Close the group */ - if (H5Gclose(grp->hdf_grpid) < 0) + if (H5Gclose(hdf5_grp->hdf_grpid) < 0) return NC_EHDFERR; hdf5_grp->hdf_grpid = 0; grp->hdf_grpid = 0; /* Attempt to rename & re-open the group, if the parent group is open */ - if (grp->parent->hdf_grpid) + if (parent_hdf5_grp->hdf_grpid) { /* Rename the group */ - if (H5Gmove(parent->hdf_grpid, grp->hdr.name, name) < 0) + if (H5Gmove(parent_hdf5_grp->hdf_grpid, grp->hdr.name, name) < 0) return NC_EHDFERR; /* Reopen the group, with the new name */ - if ((hdf5_grp->hdf_grpid = H5Gopen2(parent->hdf_grpid, name, H5P_DEFAULT)) < 0) + if ((hdf5_grp->hdf_grpid = H5Gopen2(parent_hdf5_grp->hdf_grpid, name, + H5P_DEFAULT)) < 0) return NC_EHDFERR; grp->hdf_grpid = hdf5_grp->hdf_grpid; } @@ -162,7 +162,7 @@ NC4_rename_grp(int grpid, const char *name) return NC_ENOMEM; grp->hdr.hashkey = NC_hashmapkey(grp->hdr.name,strlen(grp->hdr.name)); /* Fix hash key */ - if(!ncindexrebuild(parent->children)) + if(!ncindexrebuild(grp->parent->children)) return NC_EINTERNAL; return NC_NOERR;