libyang REFACTOR avoid constant literals
Improve readability of the code.
Includes also unification of "no break in the case" comment to "fall
through".
diff --git a/src/tree_schema_helpers.c b/src/tree_schema_helpers.c
index b8fc9e9..7933d71 100644
--- a/src/tree_schema_helpers.c
+++ b/src/tree_schema_helpers.c
@@ -63,7 +63,7 @@
LY_CHECK_ARG_RET(ctx ? PARSER_CTX(ctx) : NULL, date, LY_EINVAL);
LY_CHECK_ERR_RET(date_len != LY_REV_SIZE - 1, LOGARG(ctx ? PARSER_CTX(ctx) : NULL, date_len), LY_EINVAL);
- /* check format */
+ /* check format: YYYY-MM-DD */
for (uint8_t i = 0; i < date_len; i++) {
if ((i == 4) || (i == 7)) {
if (date[i] != '-') {
@@ -497,8 +497,8 @@
LY_ERR ret = LY_SUCCESS;
/* check name collisions - typedefs and groupings */
- ids_global = lyht_new(8, sizeof(char *), lysp_id_cmp, NULL, 1);
- ids_scoped = lyht_new(8, sizeof(char *), lysp_id_cmp, NULL, 1);
+ ids_global = lyht_new(LYHT_MIN_SIZE, sizeof(char *), lysp_id_cmp, NULL, 1);
+ ids_scoped = lyht_new(LYHT_MIN_SIZE, sizeof(char *), lysp_id_cmp, NULL, 1);
LY_ARRAY_FOR(mod->typedefs, v) {
ret = lysp_check_dup_typedef(ctx, NULL, &mod->typedefs[v], ids_global, ids_scoped);
LY_CHECK_GOTO(ret, cleanup);
@@ -697,7 +697,7 @@
/* revision */
if (rev) {
len = dot - ++rev;
- if (!revs || (len != 10) || strncmp(revs[0].date, rev, len)) {
+ if (!revs || (len != LY_REV_SIZE - 1) || strncmp(revs[0].date, rev, len)) {
LOGWRN(ctx, "File name \"%s\" does not match module revision \"%s\".", filename,
revs ? revs[0].date : "none");
}