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/tree_schema.c b/src/tree_schema.c
index dc2cf6e..3b6bc19 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -1016,7 +1016,7 @@
     /* make sure that the newest revision is at position 0 */
     lysp_sort_revisions(mod->parsed->revs);
     if (mod->parsed->revs) {
-        mod->revision = lydict_insert(ctx, mod->parsed->revs[0].date, 0);
+        LY_CHECK_GOTO(ret = lydict_insert(ctx, mod->parsed->revs[0].date, 0, &mod->revision), error);
     }
 
     /* decide the latest revision */