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/parser_json.c b/src/parser_json.c
index 8a9d280..776c65b 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -317,8 +317,8 @@
                 }
                 if (!p) {
                     LY_ARRAY_NEW_GOTO(ctx, prefixes, p, ret, error);
-                    p->id = lydict_insert(ctx, start, len);
-                    p->module_name = lydict_insert(ctx, start, len);
+                    LY_CHECK_GOTO(ret = lydict_insert(ctx, start, len, &p->id), error);
+                    LY_CHECK_GOTO(ret = lydict_insert(ctx, start, len, &p->module_name), error);
                 } /* else the prefix already present */
             }
             stop = stop + bytes;
@@ -569,7 +569,7 @@
         if (prev != meta_container->name) {
             /* metas' names are stored in dictionary, so checking pointers must works */
             lydict_remove(lydctx->jsonctx->ctx, prev);
-            prev = lydict_insert(lydctx->jsonctx->ctx, meta_container->name, 0);
+            LY_CHECK_GOTO(ret = lydict_insert(lydctx->jsonctx->ctx, meta_container->name, 0, &prev), cleanup);
             instance = 1;
         } else {
             instance++;