dictionary REFACTOR unify functions pattern to return LY_ERR

Change API functions manipulating with libyang dictionary to return
LY_ERR value as a primary indicator of the result and the value from the
dictionary is returned via optional output parameter.
diff --git a/src/xpath.c b/src/xpath.c
index c20a384..bc23eae 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -2678,7 +2678,7 @@
     /* init lyxp_expr structure */
     ret = calloc(1, sizeof *ret);
     LY_CHECK_ERR_GOTO(!ret, LOGMEM(ctx), error);
-    ret->expr = lydict_insert(ctx, expr, expr_len);
+    LY_CHECK_GOTO(lydict_insert(ctx, expr, expr_len, &ret->expr), error);
     LY_CHECK_ERR_GOTO(!ret->expr, LOGMEM(ctx), error);
     ret->used = 0;
     ret->size = LYXP_EXPR_SIZE_START;
@@ -2978,7 +2978,7 @@
 
     dup->used = exp->used;
     dup->size = exp->used;
-    dup->expr = lydict_insert(ctx, exp->expr, 0);
+    LY_CHECK_GOTO(lydict_insert(ctx, exp->expr, 0, &dup->expr), error);
 
     return dup;
 
@@ -7001,7 +7001,7 @@
     if (!scnode && moveto_mod) {
         /* we are not able to match based on a schema node and not all the modules match,
          * use dictionary for efficient comparison */
-        ncname_dict = lydict_insert(set->ctx, ncname, ncname_len);
+        LY_CHECK_GOTO(rc = lydict_insert(set->ctx, ncname, ncname_len, &ncname_dict), cleanup);
     }
 
 moveto: