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/xml.c b/src/xml.c
index 516fe4b..8a1a7a2 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -255,14 +255,14 @@
                 move_input(xmlctx, 2);
                 sectname = "Comment";
                 endtag = "-->";
-                endtag_len = 3;
-            } else if (!strncmp(xmlctx->in->current, "[CDATA[", 7)) {
+                endtag_len = ly_strlen_const("-->");
+            } else if (!strncmp(xmlctx->in->current, "[CDATA[", ly_strlen_const("[CDATA["))) {
                 /* CDATA section */
-                move_input(xmlctx, 7);
+                move_input(xmlctx, ly_strlen_const("[CDATA["));
                 sectname = "CData";
                 endtag = "]]>";
-                endtag_len = 3;
-            } else if (!strncmp(xmlctx->in->current, "DOCTYPE", 7)) {
+                endtag_len = ly_strlen_const("]]>");
+            } else if (!strncmp(xmlctx->in->current, "DOCTYPE", ly_strlen_const("DOCTYPE"))) {
                 /* Document type declaration - not supported */
                 LOGVAL(ctx, LY_VLOG_LINE, &xmlctx->line, LY_VCODE_NSUPP, "Document Type Declaration");
                 return LY_EVALID;
@@ -389,21 +389,21 @@
             ++offset;
             if (in[offset] != '#') {
                 /* entity reference - only predefined references are supported */
-                if (!strncmp(&in[offset], "lt;", 3)) {
+                if (!strncmp(&in[offset], "lt;", ly_strlen_const("lt;"))) {
                     buf[len++] = '<';
-                    in += 4; /* &lt; */
-                } else if (!strncmp(&in[offset], "gt;", 3)) {
+                    in += ly_strlen_const("&lt;");
+                } else if (!strncmp(&in[offset], "gt;", ly_strlen_const("gt;"))) {
                     buf[len++] = '>';
-                    in += 4; /* &gt; */
-                } else if (!strncmp(&in[offset], "amp;", 4)) {
+                    in += ly_strlen_const("&gt;");
+                } else if (!strncmp(&in[offset], "amp;", ly_strlen_const("amp;"))) {
                     buf[len++] = '&';
-                    in += 5; /* &amp; */
-                } else if (!strncmp(&in[offset], "apos;", 5)) {
+                    in += ly_strlen_const("&amp;");
+                } else if (!strncmp(&in[offset], "apos;", ly_strlen_const("apos;"))) {
                     buf[len++] = '\'';
-                    in += 6; /* &apos; */
-                } else if (!strncmp(&in[offset], "quot;", 5)) {
+                    in += ly_strlen_const("&apos;");
+                } else if (!strncmp(&in[offset], "quot;", ly_strlen_const("quot;"))) {
                     buf[len++] = '\"';
-                    in += 6; /* &quot; */
+                    in += ly_strlen_const("&quot;");
                 } else {
                     LOGVAL(ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_SYNTAX,
                             "Entity reference \"%.*s\" not supported, only predefined references allowed.", 10, &in[offset - 1]);
@@ -416,18 +416,18 @@
                 ++offset;
                 if (isdigit(in[offset])) {
                     for (n = 0; isdigit(in[offset]); offset++) {
-                        n = (10 * n) + (in[offset] - '0');
+                        n = (LY_BASE_DEC * n) + (in[offset] - '0');
                     }
                 } else if ((in[offset] == 'x') && isxdigit(in[offset + 1])) {
                     for (n = 0, ++offset; isxdigit(in[offset]); offset++) {
                         if (isdigit(in[offset])) {
                             u = (in[offset] - '0');
                         } else if (in[offset] > 'F') {
-                            u = 10 + (in[offset] - 'a');
+                            u = LY_BASE_DEC + (in[offset] - 'a');
                         } else {
-                            u = 10 + (in[offset] - 'A');
+                            u = LY_BASE_DEC + (in[offset] - 'A');
                         }
-                        n = (16 * n) + u;
+                        n = (LY_BASE_HEX * n) + u;
                     }
                 } else {
                     LOGVAL(ctx, LY_VLOG_LINE, &xmlctx->line, LYVE_SYNTAX, "Invalid character reference \"%.*s\".", 12, p);
@@ -847,8 +847,9 @@
     }
 
     switch (xmlctx->status) {
-    /* content |</elem> */
     case LYXML_ELEM_CONTENT:
+        /* content |</elem> */
+
         /* handle special case when empty content for "<elem/>" was returned */
         if (xmlctx->in->current[0] == '/') {
             assert(xmlctx->elements.count);
@@ -862,10 +863,10 @@
             xmlctx->status = LYXML_ELEM_CLOSE;
             break;
         }
-    /* fallthrough */
-
-    /* </elem>| <elem2>* */
+    /* fall through */
     case LYXML_ELEM_CLOSE:
+        /* </elem>| <elem2>* */
+
         /* parse next element, if any */
         ret = lyxml_next_element(xmlctx, &xmlctx->prefix, &xmlctx->prefix_len, &xmlctx->name, &xmlctx->name_len, &closing);
         LY_CHECK_GOTO(ret, cleanup);
@@ -890,11 +891,11 @@
         }
         break;
 
-    /* <elem| attr='val'* > content  */
     case LYXML_ELEMENT:
-
-    /* attr='val'| attr='val'* > content */
+    /* <elem| attr='val'* > content  */
     case LYXML_ATTR_CONTENT:
+        /* attr='val'| attr='val'* > content */
+
         /* parse attribute name, if any */
         ret = lyxml_next_attribute(xmlctx, &xmlctx->prefix, &xmlctx->prefix_len, &xmlctx->name, &xmlctx->name_len);
         LY_CHECK_GOTO(ret, cleanup);
@@ -936,8 +937,9 @@
         }
         break;
 
-    /* attr|='val' */
     case LYXML_ATTRIBUTE:
+        /* attr|='val' */
+
         /* skip formatting and parse value */
         ret = lyxml_next_attr_content(xmlctx, &xmlctx->value, &xmlctx->value_len, &xmlctx->ws_only, &xmlctx->dynamic);
         LY_CHECK_GOTO(ret, cleanup);
@@ -946,8 +948,8 @@
         xmlctx->status = LYXML_ATTR_CONTENT;
         break;
 
-    /* </elem>   |EOF */
     case LYXML_END:
+        /* </elem>   |EOF */
         /* nothing to do */
         break;
     }
@@ -976,7 +978,7 @@
             *next = LYXML_ELEM_CLOSE;
             break;
         }
-    /* fallthrough */
+    /* fall through */
     case LYXML_ELEM_CLOSE:
         /* parse next element, if any */
         ret = lyxml_next_element(xmlctx, &prefix, &prefix_len, &name, &name_len, &closing);
@@ -1064,7 +1066,7 @@
                 ret = ly_print_(out, "&quot;");
                 break;
             }
-        /* falls through */
+        /* fall through */
         default:
             ret = ly_write_(out, &text[u], 1);
             break;