diff --git a/apps/cli/cli_common.c b/apps/cli/cli_common.c index 4bc85d16..1f5f5ca6 100644 --- a/apps/cli/cli_common.c +++ b/apps/cli/cli_common.c @@ -945,23 +945,15 @@ compare_db_names(clixon_handle h, if (clicon_rpc_get_config(h, NULL, db1, "/", NULL, NULL, &xc1) < 0) goto done; if ((xerr = xpath_first(xc1, NULL, "/rpc-error")) != NULL){ -#if 1 if (clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Get configuration") < 0) goto done; -#else - clixon_netconf_error(h, xerr, "Get configuration", NULL); -#endif goto done; } if (clicon_rpc_get_config(h, NULL, db2, "/", NULL, NULL, &xc2) < 0) goto done; if ((xerr = xpath_first(xc2, NULL, "/rpc-error")) != NULL){ -#if 1 if (clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Get configuration") < 0) goto done; -#else - clixon_netconf_error(h, xerr, "Get configuration", NULL); -#endif goto done; } /* Note that XML and TEXT uses a (new) structured in-mem algorithm while @@ -1129,12 +1121,8 @@ load_config_file(clixon_handle h, if ((ret = clixon_xml_parse_file(fp, YB_NONE, yspec, &xt, &xerr)) < 0) goto done; if (ret == 0){ -#if 1 if (clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Loading %s", filename) < 0) goto done; -#else - clixon_netconf_error(h, xerr, "Loading", filename); -#endif goto done; } break; @@ -1142,12 +1130,8 @@ load_config_file(clixon_handle h, if ((ret = clixon_json_parse_file(fp, 1, YB_NONE, yspec, &xt, &xerr)) < 0) goto done; if (ret == 0){ -#if 1 if (clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Loading %s", filename) < 0) goto done; -#else - clixon_netconf_error(h, xerr, "Loading", filename); -#endif goto done; } break; @@ -1158,12 +1142,8 @@ load_config_file(clixon_handle h, if ((ret = clixon_text_syntax_parse_file(fp, YB_MODULE_NEXT, yspec, &xt, &xerr)) < 0) goto done; if (ret == 0){ -#if 1 if (clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Loading %s", filename) < 0) goto done; -#else - clixon_netconf_error(h, xerr, "Loading", filename); -#endif goto done; } break; @@ -1303,12 +1283,8 @@ save_config_file(clixon_handle h, goto done; } if ((xerr = xpath_first(xt, NULL, "/rpc-error")) != NULL){ -#if 1 if (clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Get configuration") < 0) goto done; -#else - clixon_netconf_error(h, xerr, "Get configuration", NULL); -#endif goto done; } /* get-config returns a tree. Save as tree so it can be used @@ -1692,12 +1668,8 @@ cli_copy_config(clixon_handle h, if (clicon_rpc_get_config(h, NULL, db, cbuf_get(cb), nsc, NULL, &x1) < 0) goto done; if ((xerr = xpath_first(x1, NULL, "/rpc-error")) != NULL){ -#if 1 if (clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Get configuration") < 0) goto done; -#else - clixon_netconf_error(h, xerr, "Get configuration", NULL); -#endif goto done; } diff --git a/apps/restconf/restconf_main_fcgi.c b/apps/restconf/restconf_main_fcgi.c index 3c7bd78c..4290a23f 100644 --- a/apps/restconf/restconf_main_fcgi.c +++ b/apps/restconf/restconf_main_fcgi.c @@ -151,12 +151,8 @@ restconf_main_config(clixon_handle h, if ((ret = clixon_xml_parse_string(inline_config, YB_MODULE, yspec, &xrestconf, &xerr)) < 0) goto done; if (ret == 0){ -#if 1 if (clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Inline restconf config") < 0) goto done; -#else - clixon_netconf_error(h, xerr, "Inline restconf config", NULL); -#endif goto done; } /* Replace parent w first child */ diff --git a/apps/restconf/restconf_main_native.c b/apps/restconf/restconf_main_native.c index 7b386b12..ac701258 100644 --- a/apps/restconf/restconf_main_native.c +++ b/apps/restconf/restconf_main_native.c @@ -679,12 +679,8 @@ restconf_clixon_backend(clixon_handle h, if (clicon_rpc_get_config(h, pw->pw_name, "running", "/restconf", nsc, NULL, &xconfig) < 0) goto done; if ((xerr = xpath_first(xconfig, NULL, "/rpc-error")) != NULL){ -#if 1 if (clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Get backend restconf config") < 0) goto done; -#else - clixon_netconf_error(h, xerr, "Get backend restconf config", NULL); -#endif goto done; } /* Extract restconf configuration */ diff --git a/apps/snmp/snmp_handler.c b/apps/snmp/snmp_handler.c index dc703296..7c855bfd 100644 --- a/apps/snmp/snmp_handler.c +++ b/apps/snmp/snmp_handler.c @@ -263,12 +263,8 @@ snmp_scalar_get(clixon_handle h, goto done; /* Detect error XXX Error handling could improve */ if ((xerr = xpath_first(xt, NULL, "/rpc-error")) != NULL){ -#if 1 if (clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Get configuration") < 0) goto done; -#else - clixon_netconf_error(h, xerr, "clicon_rpc_get", NULL); -#endif goto done; } x = xpath_first(xt, nsc, "%s", xpath); diff --git a/include/clixon_custom.h b/include/clixon_custom.h index 19c56d8d..040880db 100644 --- a/include/clixon_custom.h +++ b/include/clixon_custom.h @@ -204,9 +204,10 @@ */ #undef RESTCONF_INLINE -/*! Backward compatible with 6.5 +/*! Backward compatible with 6.5 for Error, Log and Debug APIs * * Note: many(most) not covered by this constant need to GREP * This includes lots of clicon->clixon namechanges, see CHANGELOG for whole list + * This constant will be removed after the 6.6 release */ #define COMPAT_6_5 diff --git a/lib/src/clixon_log.c b/lib/src/clixon_log.c index 547d5bea..b9c57710 100644 --- a/lib/src/clixon_log.c +++ b/lib/src/clixon_log.c @@ -103,10 +103,6 @@ clixon_log_init(clixon_handle h, int upto, int flags) { - if (h == NULL){ - errno = EINVAL; - return -1; - } _log_clixon_h = h; _log_flags = flags; if (flags & CLIXON_LOG_SYSLOG){ diff --git a/lib/src/clixon_netconf_lib.c b/lib/src/clixon_netconf_lib.c index 660ad497..57cf2044 100644 --- a/lib/src/clixon_netconf_lib.c +++ b/lib/src/clixon_netconf_lib.c @@ -2354,7 +2354,7 @@ netconf_input_chunked_framing(char ch, * printf("%s", cbuf_get(cb)); * cbuf_free(cb); * @endcode - * @see clixon_netconf_error_fn + * @see clixon_err_netconf_fn */ int netconf_err2cb(clixon_handle h, @@ -2407,7 +2407,7 @@ netconf_err2cb(clixon_handle h, * @retval 0 OK * @retval -1 Error * @see netconf_err2cb - * @see clixon_netconf_error macro + * @see clixon_err_netconf macro */ int clixon_err_netconf_fn(clixon_handle h, diff --git a/lib/src/clixon_proto_client.c b/lib/src/clixon_proto_client.c index 2746d171..3f117ea3 100644 --- a/lib/src/clixon_proto_client.c +++ b/lib/src/clixon_proto_client.c @@ -509,7 +509,6 @@ clicon_rpc_netconf_xml(clixon_handle h, * xml_nsctx_free(nsc); * @endcode * @see clicon_rpc_get - * @see clixon_netconf_error * @note the netconf return message is yang populated, as well as the return data */ int @@ -671,11 +670,7 @@ clicon_rpc_edit_config(clixon_handle h, if (clicon_rpc_msg(h, msg, &xret) < 0) goto done; if ((xerr = xpath_first(xret, NULL, "//rpc-error")) != NULL){ -#if 1 clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Editing configuration"); -#else - clixon_netconf_error(h, xerr, "Editing configuration", NULL); -#endif goto done; } retval = 0; @@ -737,11 +732,7 @@ clicon_rpc_copy_config(clixon_handle h, if (clicon_rpc_msg(h, msg, &xret) < 0) goto done; if ((xerr = xpath_first(xret, NULL, "//rpc-error")) != NULL){ -#if 1 clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Copying configuration"); -#else - clixon_netconf_error(h, xerr, "Copying configuration", NULL); -#endif goto done; } retval = 0; @@ -799,11 +790,7 @@ clicon_rpc_delete_config(clixon_handle h, if (clicon_rpc_msg(h, msg, &xret) < 0) goto done; if ((xerr = xpath_first(xret, NULL, "//rpc-error")) != NULL){ -#if 1 clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Deleting configuration"); -#else - clixon_netconf_error(h, xerr, "Deleting configuration", NULL); -#endif goto done; } retval = 0; @@ -857,11 +844,7 @@ clicon_rpc_lock(clixon_handle h, if (clicon_rpc_msg(h, msg, &xret) < 0) goto done; if ((xerr = xpath_first(xret, NULL, "//rpc-error")) != NULL){ -#if 1 clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Locking configuration"); -#else - clixon_netconf_error(h, xerr, "Locking configuration", NULL); -#endif goto done; } retval = 0; @@ -915,11 +898,7 @@ clicon_rpc_unlock(clixon_handle h, if (clicon_rpc_msg(h, msg, &xret) < 0) goto done; if ((xerr = xpath_first(xret, NULL, "//rpc-error")) != NULL){ -#if 1 clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Unlocking configuration"); -#else - clixon_netconf_error(h, xerr, "Configuration unlock", NULL); -#endif goto done; } retval = 0; @@ -1350,11 +1329,7 @@ clicon_rpc_close_session(clixon_handle h) clicon_client_socket_set(h, -1); } if ((xerr = xpath_first(xret, NULL, "//rpc-error")) != NULL){ -#if 1 clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Close session"); -#else - clixon_netconf_error(h, xerr, "Close session", NULL); -#endif goto done; } retval = 0; @@ -1408,11 +1383,7 @@ clicon_rpc_kill_session(clixon_handle h, if (clicon_rpc_msg(h, msg, &xret) < 0) goto done; if ((xerr = xpath_first(xret, NULL, "//rpc-error")) != NULL){ -#if 1 clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Kill session"); -#else - clixon_netconf_error(h, xerr, "Kill session", NULL); -#endif goto done; } retval = 0; @@ -1468,11 +1439,7 @@ clicon_rpc_validate(clixon_handle h, if (clicon_rpc_msg(h, msg, &xret) < 0) goto done; if ((xerr = xpath_first(xret, NULL, "//rpc-error")) != NULL){ -#if 1 clixon_err_netconf(h, OE_NETCONF, 0, xerr, CLIXON_ERRSTR_VALIDATE_FAILED); -#else - clixon_netconf_error(h, xerr, CLIXON_ERRSTR_VALIDATE_FAILED, NULL); -#endif retval = 0; goto done; } @@ -1579,11 +1546,7 @@ clicon_rpc_commit(clixon_handle h, if (clicon_rpc_msg(h, msg, &xret) < 0) goto done; if ((xerr = xpath_first(xret, NULL, "//rpc-error")) != NULL){ -#if 1 clixon_err_netconf(h, OE_NETCONF, 0, xerr, CLIXON_ERRSTR_COMMIT_FAILED); -#else - clixon_netconf_error(h, xerr, CLIXON_ERRSTR_COMMIT_FAILED, NULL); -#endif retval = 0; goto done; } @@ -1642,11 +1605,7 @@ clicon_rpc_discard_changes(clixon_handle h) if (clicon_rpc_msg(h, msg, &xret) < 0) goto done; if ((xerr = xpath_first(xret, NULL, "//rpc-error")) != NULL){ -#if 1 clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Discard changes"); -#else - clixon_netconf_error(h, xerr, "Discard changes", NULL); -#endif goto done; } retval = 0; @@ -1711,11 +1670,7 @@ clicon_rpc_create_subscription(clixon_handle h, if (clicon_rpc_msg_persistent(h, msg, &xret, s0) < 0) goto done; if ((xerr = xpath_first(xret, NULL, "//rpc-error")) != NULL){ -#if 1 clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Create subscription"); -#else - clixon_netconf_error(h, xerr, "Create subscription", NULL); -#endif goto done; } retval = 0; @@ -1770,11 +1725,7 @@ clicon_rpc_debug(clixon_handle h, if (clicon_rpc_msg(h, msg, &xret) < 0) goto done; if ((xerr = xpath_first(xret, NULL, "//rpc-error")) != NULL){ -#if 1 clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Debug"); -#else - clixon_netconf_error(h, xerr, "Debug", NULL); -#endif goto done; } if (xpath_first(xret, NULL, "//rpc-reply/ok") == NULL){ @@ -1840,11 +1791,7 @@ clicon_rpc_restconf_debug(clixon_handle h, if (clicon_rpc_msg(h, msg, &xret) < 0) goto done; if ((xerr = xpath_first(xret, NULL, "//rpc-error")) != NULL){ -#if 1 clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Debug"); -#else - clixon_netconf_error(h, xerr, "Debug", NULL); -#endif goto done; } if (xpath_first(xret, NULL, "//rpc-reply/ok") == NULL){ @@ -1933,11 +1880,7 @@ clicon_hello_req(clixon_handle h, if (clicon_rpc_msg(h, msg, &xret) < 0) goto done; if ((xerr = xpath_first(xret, NULL, "//rpc-error")) != NULL){ -#if 1 clixon_err_netconf(h, OE_NETCONF, 0, xerr, "Hello"); -#else - clixon_netconf_error(h, xerr, "Hello", NULL); -#endif goto done; } if ((x = xpath_first(xret, NULL, "hello/session-id")) == NULL){