summaryrefslogtreecommitdiffstats
path: root/tools/lib/h5tools_ref.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib/h5tools_ref.c')
-rw-r--r--tools/lib/h5tools_ref.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/tools/lib/h5tools_ref.c b/tools/lib/h5tools_ref.c
index 16a949d..6153f0c 100644
--- a/tools/lib/h5tools_ref.c
+++ b/tools/lib/h5tools_ref.c
@@ -107,19 +107,21 @@ static int
init_ref_path_table(void)
{
/* Sanity check */
- HDassert(thefile > 0);
-
- /* Create skip list to store reference path information */
- if((ref_path_table = H5SL_create(H5SL_TYPE_HADDR, NULL))==NULL)
+ if(thefile > 0) {
+ /* Create skip list to store reference path information */
+ if((ref_path_table = H5SL_create(H5SL_TYPE_HADDR, NULL))==NULL)
+ return (-1);
+
+ /* Iterate over objects in this file */
+ if(h5trav_visit(thefile, "/", TRUE, TRUE, init_ref_path_cb, NULL, NULL) < 0) {
+ error_msg("unable to construct reference path table\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ } /* end if */
+
+ return(0);
+ }
+ else
return (-1);
-
- /* Iterate over objects in this file */
- if(h5trav_visit(thefile, "/", TRUE, TRUE, init_ref_path_cb, NULL, NULL) < 0) {
- error_msg("unable to construct reference path table\n");
- h5tools_setstatus(EXIT_FAILURE);
- } /* end if */
-
- return(0);
}
/*-------------------------------------------------------------------------
@@ -212,16 +214,17 @@ ref_path_table_put(const char *path, haddr_t objno)
{
ref_path_node_t *new_node;
- HDassert(ref_path_table);
- HDassert(path);
-
- if((new_node = (ref_path_node_t *)HDmalloc(sizeof(ref_path_node_t))) == NULL)
- return(-1);
+ if(ref_path_table && path) {
+ if((new_node = (ref_path_node_t *)HDmalloc(sizeof(ref_path_node_t))) == NULL)
+ return(-1);
- new_node->objno = objno;
- new_node->path = HDstrdup(path);
+ new_node->objno = objno;
+ new_node->path = HDstrdup(path);
- return(H5SL_insert(ref_path_table, new_node, &(new_node->objno)));
+ return(H5SL_insert(ref_path_table, new_node, &(new_node->objno)));
+ }
+ else
+ return (-1);
}
/*