context CHANGE redesign ly_ctx_unset_searchdir*() functions
Instead of removing by index, introduce new function
ly_ctx_unset_searchdir_last() which should be more useful. Also rename
ly_ctx_unset_searchdirs() by removing the trailing 's' - besides the
consistency with the setter, it should be also better due to possible
confusing with the function from 1.x which had different parameters.
diff --git a/tests/utests/test_context.c b/tests/utests/test_context.c
index 2616510..7fc369d 100644
--- a/tests/utests/test_context.c
+++ b/tests/utests/test_context.c
@@ -92,8 +92,8 @@
logbuf_assert("Invalid argument ctx (ly_ctx_set_searchdir()).");
assert_null(ly_ctx_get_searchdirs(NULL));
logbuf_assert("Invalid argument ctx (ly_ctx_get_searchdirs()).");
- assert_int_equal(LY_EINVAL, ly_ctx_unset_searchdirs(NULL, NULL));
- logbuf_assert("Invalid argument ctx (ly_ctx_unset_searchdirs()).");
+ assert_int_equal(LY_EINVAL, ly_ctx_unset_searchdir(NULL, NULL));
+ logbuf_assert("Invalid argument ctx (ly_ctx_unset_searchdir()).");
/* readable and executable, but not a directory */
assert_int_equal(LY_EINVAL, ly_ctx_set_searchdir(ctx, TESTS_BIN"/utest_context"));
@@ -141,24 +141,24 @@
/* removing searchpaths */
/* nonexisting */
- assert_int_equal(LY_EINVAL, ly_ctx_unset_searchdirs(ctx, "/nonexistingfile"));
- logbuf_assert("Invalid argument value (ly_ctx_unset_searchdirs()).");
+ assert_int_equal(LY_EINVAL, ly_ctx_unset_searchdir(ctx, "/nonexistingfile"));
+ logbuf_assert("Invalid argument value (ly_ctx_unset_searchdir()).");
/* first */
- assert_int_equal(LY_SUCCESS, ly_ctx_unset_searchdirs(ctx, TESTS_BIN"/utests"));
+ assert_int_equal(LY_SUCCESS, ly_ctx_unset_searchdir(ctx, TESTS_BIN"/utests"));
assert_string_not_equal(TESTS_BIN"/utests", list[0]);
assert_int_equal(7, ctx->search_paths.count);
/* middle */
- assert_int_equal(LY_SUCCESS, ly_ctx_unset_searchdirs(ctx, TESTS_SRC));
+ assert_int_equal(LY_SUCCESS, ly_ctx_unset_searchdir(ctx, TESTS_SRC));
assert_int_equal(6, ctx->search_paths.count);
/* last */
- assert_int_equal(LY_SUCCESS, ly_ctx_unset_searchdirs(ctx, "/home"));
+ assert_int_equal(LY_SUCCESS, ly_ctx_unset_searchdir(ctx, "/home"));
assert_int_equal(5, ctx->search_paths.count);
/* all */
- assert_int_equal(LY_SUCCESS, ly_ctx_unset_searchdirs(ctx, NULL));
+ assert_int_equal(LY_SUCCESS, ly_ctx_unset_searchdir(ctx, NULL));
assert_int_equal(0, ctx->search_paths.count);
/* again - no change */
- assert_int_equal(LY_SUCCESS, ly_ctx_unset_searchdirs(ctx, NULL));
+ assert_int_equal(LY_SUCCESS, ly_ctx_unset_searchdir(ctx, NULL));
/* cleanup */
ly_ctx_destroy(ctx, NULL);