From 51412aa48c6435ef7798f563fb269b13b6c0418c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 30 Mar 2017 15:03:31 -0500 Subject: HDFFV-10143 Cleanup due to comments --- src/H5PL.c | 6 ++---- src/H5PLpkg.h | 4 ++-- test/plugin.c | 14 +++++++------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/H5PL.c b/src/H5PL.c index 0957629..78ccd88 100644 --- a/src/H5PL.c +++ b/src/H5PL.c @@ -558,18 +558,16 @@ herr_t H5PLremove(unsigned int index) { herr_t ret_value = SUCCEED; /* Return value */ - char *dl_path = NULL; unsigned int plindex; FUNC_ENTER_API(FAIL) if(H5PL_num_paths_g == 0) HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "no directories in table") - if(NULL == (dl_path = H5PL_path_table_g[index])) + if(NULL == H5PL_path_table_g[index]) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "no directory path at index") + H5PL_path_table_g[plindex] = (char *)H5MM_xfree(H5PL_path_table_g[plindex]); for(plindex = index; plindex < (unsigned int)H5PL_num_paths_g; plindex++) H5PL_path_table_g[plindex] = H5PL_path_table_g[plindex + 1]; - if(H5PL_path_table_g[plindex]) - dl_path = (char *)H5MM_xfree(dl_path); H5PL_num_paths_g--; H5PL_path_table_g[H5PL_num_paths_g] = NULL; diff --git a/src/H5PLpkg.h b/src/H5PLpkg.h index 2761a33..5cf3096 100644 --- a/src/H5PLpkg.h +++ b/src/H5PLpkg.h @@ -29,13 +29,13 @@ /* Package Private Macros */ /**************************/ +#define H5PL_MAX_PATH_NUM 16 + /****************************/ /* Package Private Typedefs */ /****************************/ -#define H5PL_MAX_PATH_NUM 16 - /*****************************/ /* Package Private Variables */ diff --git a/test/plugin.c b/test/plugin.c index 0fca40f..3c1a71a 100644 --- a/test/plugin.c +++ b/test/plugin.c @@ -774,7 +774,7 @@ test_filter_path_apis(void) TESTING(" append"); /* Create multiple paths to fill table */ - for (i=0; i < 16; i++) { + for (i=0; i < H5PL_MAX_PATH_NUM; i++) { HDsprintf(pathname, "a_path_%d", i); if (H5PLappend(pathname) < 0) { HDfprintf(stderr," at %d: %s\n", i, pathname); @@ -782,7 +782,7 @@ test_filter_path_apis(void) } } /* Verify the table is full */ - if (H5PLsize() != 16) TEST_ERROR + if (H5PLsize() != H5PL_MAX_PATH_NUM) TEST_ERROR PASSED(); TESTING(" append (exceed)"); @@ -796,7 +796,7 @@ test_filter_path_apis(void) /* Exceed the max path removal */ H5E_BEGIN_TRY { - ret = H5PLremove(16); + ret = H5PLremove(H5PL_MAX_PATH_NUM); } H5E_END_TRY if (ret >= 0) TEST_ERROR @@ -836,7 +836,7 @@ test_filter_path_apis(void) PASSED(); TESTING(" get (bounds exceed)"); - if ((pathlen = H5PLget(16, NULL, 0)) > 0) + if ((pathlen = H5PLget(H5PL_MAX_PATH_NUM, NULL, 0)) > 0) TEST_ERROR PASSED(); @@ -865,7 +865,7 @@ test_filter_path_apis(void) } /* Verify the table is full */ - if (H5PLsize() != 16) TEST_ERROR + if (H5PLsize() != H5PL_MAX_PATH_NUM) TEST_ERROR /* Verify that the entries were moved */ if (H5PLget(8, pathname, 256) <= 0) @@ -901,7 +901,7 @@ test_filter_path_apis(void) } /* Verify the table is full */ - if (H5PLsize() != 16) TEST_ERROR + if (H5PLsize() != H5PL_MAX_PATH_NUM) TEST_ERROR /* Verify that the entries were not moved */ if (H5PLget(0, pathname, 256) <= 0) @@ -952,7 +952,7 @@ test_filter_path_apis(void) PASSED(); /* Verify the table is full */ - if (H5PLsize() != 16) TEST_ERROR + if (H5PLsize() != H5PL_MAX_PATH_NUM) TEST_ERROR TESTING(" insert (exceed)"); /* Exceed the max path insert */ -- cgit v0.12