context CHANGE unify names of the context options manipulation functions
diff --git a/src/context.c b/src/context.c
index d01f4f7..cbf5afc 100644
--- a/src/context.c
+++ b/src/context.c
@@ -266,7 +266,7 @@
}
API LY_ERR
-ly_ctx_set_option(struct ly_ctx *ctx, int option)
+ly_ctx_set_options(struct ly_ctx *ctx, int option)
{
LY_CHECK_ARG_RET(ctx, ctx, LY_EINVAL);
LY_CHECK_ERR_RET(option & LY_CTX_NOYANGLIBRARY, LOGARG(ctx, option), LY_EINVAL);
@@ -278,7 +278,7 @@
}
API LY_ERR
-ly_ctx_unset_option(struct ly_ctx *ctx, int option)
+ly_ctx_unset_options(struct ly_ctx *ctx, int option)
{
LY_CHECK_ARG_RET(ctx, ctx, LY_EINVAL);
LY_CHECK_ERR_RET(option & LY_CTX_NOYANGLIBRARY, LOGARG(ctx, option), LY_EINVAL);
diff --git a/src/context.h b/src/context.h
index f8260bf..1f9895f 100644
--- a/src/context.h
+++ b/src/context.h
@@ -151,7 +151,7 @@
* @param[in] option Combination of the context's options to be set, see @ref contextoptions.
* @return LY_ERR value.
*/
-LY_ERR ly_ctx_set_option(struct ly_ctx *ctx, int option);
+LY_ERR ly_ctx_set_options(struct ly_ctx *ctx, int option);
/**
* @brief Unset some of the context's options, see @ref contextoptions.
@@ -159,7 +159,7 @@
* @param[in] option Combination of the context's options to be unset, see @ref contextoptions.
* @return LY_ERR value.
*/
-LY_ERR ly_ctx_unset_option(struct ly_ctx *ctx, int option);
+LY_ERR ly_ctx_unset_options(struct ly_ctx *ctx, int option);
/**
* @brief Get current ID of the modules set. The value is available also
diff --git a/tests/src/test_context.c b/tests/src/test_context.c
index 58f52d4..d6d2334 100644
--- a/tests/src/test_context.c
+++ b/tests/src/test_context.c
@@ -189,65 +189,65 @@
assert_int_equal(0, ly_ctx_get_options(NULL));
logbuf_assert("Invalid argument ctx (ly_ctx_get_options()).");
- assert_int_equal(LY_EINVAL, ly_ctx_set_option(NULL, 0));
- logbuf_assert("Invalid argument ctx (ly_ctx_set_option()).");
- assert_int_equal(LY_EINVAL, ly_ctx_unset_option(NULL, 0));
- logbuf_assert("Invalid argument ctx (ly_ctx_unset_option()).");
+ assert_int_equal(LY_EINVAL, ly_ctx_set_options(NULL, 0));
+ logbuf_assert("Invalid argument ctx (ly_ctx_set_options()).");
+ assert_int_equal(LY_EINVAL, ly_ctx_unset_options(NULL, 0));
+ logbuf_assert("Invalid argument ctx (ly_ctx_unset_options()).");
/* option not allowed to be changed */
- assert_int_equal(LY_EINVAL, ly_ctx_set_option(ctx, LY_CTX_NOYANGLIBRARY));
- logbuf_assert("Invalid argument option (ly_ctx_set_option()).");
- assert_int_equal(LY_EINVAL, ly_ctx_set_option(ctx, LY_CTX_NOYANGLIBRARY));
- logbuf_assert("Invalid argument option (ly_ctx_set_option()).");
+ assert_int_equal(LY_EINVAL, ly_ctx_set_options(ctx, LY_CTX_NOYANGLIBRARY));
+ logbuf_assert("Invalid argument option (ly_ctx_set_options()).");
+ assert_int_equal(LY_EINVAL, ly_ctx_set_options(ctx, LY_CTX_NOYANGLIBRARY));
+ logbuf_assert("Invalid argument option (ly_ctx_set_options()).");
/* unset */
/* LY_CTX_ALLIMPLEMENTED */
assert_int_not_equal(0, ctx->flags & LY_CTX_ALLIMPLEMENTED);
- assert_int_equal(LY_SUCCESS, ly_ctx_unset_option(ctx, LY_CTX_ALLIMPLEMENTED));
+ assert_int_equal(LY_SUCCESS, ly_ctx_unset_options(ctx, LY_CTX_ALLIMPLEMENTED));
assert_int_equal(0, ctx->flags & LY_CTX_ALLIMPLEMENTED);
/* LY_CTX_DISABLE_SEARCHDIRS */
assert_int_not_equal(0, ctx->flags & LY_CTX_DISABLE_SEARCHDIRS);
- assert_int_equal(LY_SUCCESS, ly_ctx_unset_option(ctx, LY_CTX_DISABLE_SEARCHDIRS));
+ assert_int_equal(LY_SUCCESS, ly_ctx_unset_options(ctx, LY_CTX_DISABLE_SEARCHDIRS));
assert_int_equal(0, ctx->flags & LY_CTX_DISABLE_SEARCHDIRS);
/* LY_CTX_DISABLE_SEARCHDIR_CWD */
assert_int_not_equal(0, ctx->flags & LY_CTX_DISABLE_SEARCHDIR_CWD);
- assert_int_equal(LY_SUCCESS, ly_ctx_unset_option(ctx, LY_CTX_DISABLE_SEARCHDIR_CWD));
+ assert_int_equal(LY_SUCCESS, ly_ctx_unset_options(ctx, LY_CTX_DISABLE_SEARCHDIR_CWD));
assert_int_equal(0, ctx->flags & LY_CTX_DISABLE_SEARCHDIR_CWD);
/* LY_CTX_PREFER_SEARCHDIRS */
assert_int_not_equal(0, ctx->flags & LY_CTX_PREFER_SEARCHDIRS);
- assert_int_equal(LY_SUCCESS, ly_ctx_unset_option(ctx, LY_CTX_PREFER_SEARCHDIRS));
+ assert_int_equal(LY_SUCCESS, ly_ctx_unset_options(ctx, LY_CTX_PREFER_SEARCHDIRS));
assert_int_equal(0, ctx->flags & LY_CTX_PREFER_SEARCHDIRS);
/* LY_CTX_TRUSTED */
assert_int_not_equal(0, ctx->flags & LY_CTX_TRUSTED);
- assert_int_equal(LY_SUCCESS, ly_ctx_unset_option(ctx, LY_CTX_TRUSTED));
+ assert_int_equal(LY_SUCCESS, ly_ctx_unset_options(ctx, LY_CTX_TRUSTED));
assert_int_equal(0, ctx->flags & LY_CTX_TRUSTED);
assert_int_equal(ctx->flags, ly_ctx_get_options(ctx));
/* set back */
/* LY_CTX_ALLIMPLEMENTED */
- assert_int_equal(LY_SUCCESS, ly_ctx_set_option(ctx, LY_CTX_ALLIMPLEMENTED));
+ assert_int_equal(LY_SUCCESS, ly_ctx_set_options(ctx, LY_CTX_ALLIMPLEMENTED));
assert_int_not_equal(0, ctx->flags & LY_CTX_ALLIMPLEMENTED);
/* LY_CTX_DISABLE_SEARCHDIRS */
- assert_int_equal(LY_SUCCESS, ly_ctx_set_option(ctx, LY_CTX_DISABLE_SEARCHDIRS));
+ assert_int_equal(LY_SUCCESS, ly_ctx_set_options(ctx, LY_CTX_DISABLE_SEARCHDIRS));
assert_int_not_equal(0, ctx->flags & LY_CTX_DISABLE_SEARCHDIRS);
/* LY_CTX_DISABLE_SEARCHDIR_CWD */
- assert_int_equal(LY_SUCCESS, ly_ctx_set_option(ctx, LY_CTX_DISABLE_SEARCHDIR_CWD));
+ assert_int_equal(LY_SUCCESS, ly_ctx_set_options(ctx, LY_CTX_DISABLE_SEARCHDIR_CWD));
assert_int_not_equal(0, ctx->flags & LY_CTX_DISABLE_SEARCHDIR_CWD);
/* LY_CTX_PREFER_SEARCHDIRS */
- assert_int_equal(LY_SUCCESS, ly_ctx_set_option(ctx, LY_CTX_PREFER_SEARCHDIRS));
+ assert_int_equal(LY_SUCCESS, ly_ctx_set_options(ctx, LY_CTX_PREFER_SEARCHDIRS));
assert_int_not_equal(0, ctx->flags & LY_CTX_PREFER_SEARCHDIRS);
/* LY_CTX_TRUSTED */
- assert_int_equal(LY_SUCCESS, ly_ctx_set_option(ctx, LY_CTX_TRUSTED));
+ assert_int_equal(LY_SUCCESS, ly_ctx_set_options(ctx, LY_CTX_TRUSTED));
assert_int_not_equal(0, ctx->flags & LY_CTX_TRUSTED);
assert_int_equal(ctx->flags, ly_ctx_get_options(ctx));
diff --git a/tools/lint/commands.c b/tools/lint/commands.c
index 41654f9..5d27c39 100644
--- a/tools/lint/commands.c
+++ b/tools/lint/commands.c
@@ -204,7 +204,7 @@
for (s = strstr(arg_ptr, "-i"); s ; s = strstr(s + 2, "-i")) {
if (s[2] == '\0' || s[2] == ' ') {
- ly_ctx_set_option(ctx, LY_CTX_ALLIMPLEMENTED);
+ ly_ctx_set_options(ctx, LY_CTX_ALLIMPLEMENTED);
s[0] = s[1] = ' ';
}
}
@@ -270,7 +270,7 @@
cleanup:
free(s);
- ly_ctx_unset_option(ctx, LY_CTX_ALLIMPLEMENTED);
+ ly_ctx_unset_options(ctx, LY_CTX_ALLIMPLEMENTED);
return ret;
}
@@ -291,7 +291,7 @@
for (s = strstr(arg_ptr, "-i"); s ; s = strstr(s + 2, "-i")) {
if (s[2] == '\0' || s[2] == ' ') {
- ly_ctx_set_option(ctx, LY_CTX_ALLIMPLEMENTED);
+ ly_ctx_set_options(ctx, LY_CTX_ALLIMPLEMENTED);
s[0] = s[1] = ' ';
}
}
@@ -336,7 +336,7 @@
cleanup:
free(s);
- ly_ctx_unset_option(ctx, LY_CTX_ALLIMPLEMENTED);
+ ly_ctx_unset_options(ctx, LY_CTX_ALLIMPLEMENTED);
return ret;
}