common CHANGE refactor lysp_check_date()

Add description and use LY_ERR as return codes.
diff --git a/src/common.c b/src/common.c
index 03d2ff2..8b6539b 100644
--- a/src/common.c
+++ b/src/common.c
@@ -152,16 +152,15 @@
     return new_mem;
 }
 
-int
+LY_ERR
 lysp_check_date(struct ly_ctx *ctx, const char *date, int date_len, const char *stmt)
 {
     int i;
     struct tm tm, tm_;
     char *r;
 
-    if (date_len != LY_REV_SIZE - 1) {
-        goto error;
-    }
+    LY_CHECK_ARG_RET(ctx, date, LY_EINVAL);
+    LY_CHECK_ERR_RET(date_len != LY_REV_SIZE - 1, LOGARG(ctx, date_len), LY_EINVAL);
 
     /* check format */
     for (i = 0; i < date_len; i++) {
@@ -188,11 +187,11 @@
         goto error;
     }
 
-    return 0;
+    return LY_SUCCESS;
 
 error:
     LOGVAL(ctx, LY_VLOG_NONE, NULL, LY_VCODE_INVAL, date_len, date, stmt);
-    return -1;
+    return LY_EINVAL;
 }
 
 int
diff --git a/src/common.h b/src/common.h
index 00fa346..f3a6e6e 100644
--- a/src/common.h
+++ b/src/common.h
@@ -248,7 +248,16 @@
  */
 void *ly_realloc(void *ptr, size_t size);
 
-int lysp_check_date(struct ly_ctx *ctx, const char *date, int date_len, const char *stmt);
+/**
+ * @brief Check date string (4DIGIT "-" 2DIGIT "-" 2DIGIT)
+ *
+ * @param[in] ctx Context to store log message.
+ * @param[in] date Date string to check (non-necessarily terminated by \0)
+ * @param[in] date_len Length of the date string, 10 expected.
+ * @param[in] stmt Statement name for error message.
+ * @return LY_ERR value.
+ */
+LY_ERR lysp_check_date(struct ly_ctx *ctx, const char *date, int date_len, const char *stmt);
 
 int lysp_get_data_line(const char *data, int fail_char);