libyang CHANGE extend input handler by line counter

So far, all the parsers were counting lines on their own, in the
parsers' specific variables. The patch unifies the place where the
line is counted and store it in the input handler.
diff --git a/src/in.c b/src/in.c
index 26f4226..8e8cf07 100644
--- a/src/in.c
+++ b/src/in.c
@@ -70,6 +70,7 @@
     (*in)->type = LY_IN_FD;
     (*in)->method.fd = fd;
     (*in)->current = (*in)->start = (*in)->func_start = addr;
+    (*in)->line = 1;
     (*in)->length = length;
 
     return LY_SUCCESS;
@@ -97,6 +98,7 @@
 
         in->method.fd = fd;
         in->current = in->start = addr;
+        in->line = 1;
         in->length = length;
     }
 
@@ -154,6 +156,7 @@
 
     (*in)->type = LY_IN_MEMORY;
     (*in)->start = (*in)->current = (*in)->func_start = str;
+    (*in)->line = 1;
 
     return LY_SUCCESS;
 }
@@ -169,6 +172,7 @@
 
     if (str) {
         in->start = in->current = str;
+        in->line = 1;
     }
 
     return data;
@@ -180,6 +184,7 @@
     LY_CHECK_ARG_RET(NULL, in, LY_EINVAL);
 
     in->current = in->func_start = in->start;
+    in->line = 1;
     return LY_SUCCESS;
 }
 
@@ -344,6 +349,12 @@
         return LY_EDENIED;
     }
 
+    for (size_t i = 0; i < count; i++) {
+        if (in->current[i] == '\n') {
+            LY_IN_NEW_LINE(in);
+        }
+    }
+
     memcpy(buf, in->current, count);
     in->current += count;
     return LY_SUCCESS;
@@ -363,6 +374,12 @@
         return LY_EDENIED;
     }
 
+    for (size_t i = 0; i < count; i++) {
+        if (in->current[i] == '\n') {
+            LY_IN_NEW_LINE(in);
+        }
+    }
+
     in->current += count;
     return LY_SUCCESS;
 }