libyang FEATURE introduce and use new ly_bool type
To indicate simple flags or true/false return values, use a standalone
ly_bool type.
We do not use stdbool's bool type to avoid need to mimic all its
features on platforms that do not provide it. ly_bool is just a simple
rename for uint8_t and the reason to use it is only a better readability
of the meaning of the variables or function's return values.
diff --git a/src/tree_schema.c b/src/tree_schema.c
index a4f81e3..dd5a031 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -44,7 +44,7 @@
{
const struct lysc_node *next = NULL;
struct lysc_node **snode;
- uint8_t action_flag = 0, notif_flag = 0;
+ ly_bool action_flag = 0, notif_flag = 0;
const struct lysc_action *actions;
const struct lysc_notif *notifs;
LY_ARRAY_COUNT_TYPE u;
@@ -549,13 +549,14 @@
* @param[in] name Name of the feature to set. Asterisk ('*') can be used to
* set all the features in the module.
* @param[in] value Desired value of the feature: 1 (enable) or 0 (disable).
+ * @param[in] skip_checks Flag to skip checking of if-features and just set @p value of the feature.
* @return LY_ERR value.
*/
static LY_ERR
-lys_feature_change(const struct lys_module *mod, const char *name, uint8_t value, uint8_t skip_checks)
+lys_feature_change(const struct lys_module *mod, const char *name, ly_bool value, ly_bool skip_checks)
{
LY_ERR ret = LY_SUCCESS;
- uint8_t all = 0;
+ ly_bool all = 0;
LY_ARRAY_COUNT_TYPE u, disabled_count;
uint32_t changed_count;
struct lysc_feature *f, **df;
@@ -774,7 +775,7 @@
}
API const struct lysc_node *
-lysc_node_is_disabled(const struct lysc_node *node, uint8_t recursive)
+lysc_node_is_disabled(const struct lysc_node *node, ly_bool recursive)
{
LY_ARRAY_COUNT_TYPE u;
@@ -972,7 +973,7 @@
}
LY_ERR
-lys_parse_mem_module(struct ly_ctx *ctx, struct ly_in *in, LYS_INFORMAT format, uint8_t implement,
+lys_parse_mem_module(struct ly_ctx *ctx, struct ly_in *in, LYS_INFORMAT format, ly_bool implement,
LY_ERR (*custom_check)(const struct ly_ctx *ctx, struct lysp_module *mod, struct lysp_submodule *submod, void *data),
void *check_data, struct lys_module **module)
{
@@ -1240,12 +1241,12 @@
}
API LY_ERR
-lys_search_localfile(const char * const *searchpaths, uint8_t cwd, const char *name, const char *revision,
+lys_search_localfile(const char * const *searchpaths, ly_bool cwd, const char *name, const char *revision,
char **localfile, LYS_INFORMAT *format)
{
LY_ERR ret = LY_EMEM;
size_t len, flen, match_len = 0, dir_len;
- uint8_t implicit_cwd = 0;
+ ly_bool implicit_cwd = 0;
char *wd, *wn = NULL;
DIR *dir = NULL;
struct dirent *file;