Restructured error,debug anf log API

Renamed functions clicon->clixon, replaced global variables w access functions
Unified clicon_netconf_error with clixon_err()
This commit is contained in:
Olof hagsand 2023-11-13 10:12:52 +01:00
parent 261469be16
commit 24a4991ec8
199 changed files with 4668 additions and 4158 deletions

View file

@ -95,7 +95,7 @@
/* typecast macro */
#define _IY ((clixon_instance_id_yacc *)_iy)
#define _YYERROR(msg) {clicon_err(OE_XML, 0, "YYERROR %s '%s' %d", (msg), clixon_instance_id_parsetext, _IY->iy_linenum); YYERROR;}
#define _YYERROR(msg) {clixon_err(OE_XML, 0, "YYERROR %s '%s' %d", (msg), clixon_instance_id_parsetext, _IY->iy_linenum); YYERROR;}
/* add _yy to error parameters */
#define YY_(msgid) msgid
@ -115,12 +115,13 @@
#include <cligen/cligen.h>
#include "clixon_err.h"
#include "clixon_log.h"
#include "clixon_queue.h"
#include "clixon_string.h"
#include "clixon_hash.h"
#include "clixon_handle.h"
#include "clixon_err.h"
#include "clixon_log.h"
#include "clixon_debug.h"
#include "clixon_yang.h"
#include "clixon_xml.h"
#include "clixon_path.h"
@ -140,7 +141,7 @@ void
clixon_instance_id_parseerror(void *_iy,
char *s)
{
clicon_err(OE_XML, 0, "%s on line %d: %s at or before: '%s'",
clixon_err(OE_XML, 0, "%s on line %d: %s at or before: '%s'",
_IY->iy_name,
_IY->iy_linenum ,
s,
@ -198,17 +199,17 @@ path_new(char *prefix,
clixon_debug(CLIXON_DBG_DETAIL, "%s(%s,%s)", __FUNCTION__, prefix, id);
if ((cp = malloc(sizeof(*cp))) == NULL){
clicon_err(OE_UNIX, errno, "malloc");
clixon_err(OE_UNIX, errno, "malloc");
goto done;
}
memset(cp, 0, sizeof(*cp));
if (prefix)
if ((cp->cp_prefix = strdup(prefix)) == NULL){
clicon_err(OE_UNIX, errno, "strdup");
clixon_err(OE_UNIX, errno, "strdup");
goto done;
}
if ((cp->cp_id = strdup(id)) == NULL){
clicon_err(OE_UNIX, errno, "strdup");
clixon_err(OE_UNIX, errno, "strdup");
goto done;
}
return cp;
@ -228,18 +229,18 @@ keyval_pos(char *uint)
clixon_debug(CLIXON_DBG_DETAIL, "%s(%s)", __FUNCTION__, uint);
if ((cvv = cvec_new(1)) == NULL) {
clicon_err(OE_UNIX, errno, "cvec_new");
clixon_err(OE_UNIX, errno, "cvec_new");
goto done;
}
cv = cvec_i(cvv, 0);
cv_type_set(cv, CGV_UINT32);
if ((ret = cv_parse1(uint, cv, &reason)) < 0){
clicon_err(OE_UNIX, errno, "cv_parse1");
clixon_err(OE_UNIX, errno, "cv_parse1");
cvv = NULL;
goto done;
}
if (ret == 0){
clicon_err(OE_UNIX, errno, "cv_parse1: %s", reason);
clixon_err(OE_UNIX, errno, "cv_parse1: %s", reason);
cvv = NULL;
goto done;
}
@ -265,11 +266,11 @@ keyval_add(cvec *cvv,
goto done;
if (cvv == NULL &&
(cvv = cvec_new(0)) == NULL) {
clicon_err(OE_UNIX, errno, "cvec_new");
clixon_err(OE_UNIX, errno, "cvec_new");
goto done;
}
if (cvec_append_var(cvv, cv) == NULL){
clicon_err(OE_UNIX, errno, "cvec_append_var");
clixon_err(OE_UNIX, errno, "cvec_append_var");
cvv = NULL;
goto done;
}
@ -288,16 +289,16 @@ keyval_set(char *name,
clixon_debug(CLIXON_DBG_DETAIL, "%s(%s=%s)", __FUNCTION__, name, val);
if ((cv = cv_new(CGV_STRING)) == NULL){
clicon_err(OE_UNIX, errno, "cv_new");
clixon_err(OE_UNIX, errno, "cv_new");
goto done;
}
if (name && cv_name_set(cv, name) == NULL){
clicon_err(OE_UNIX, errno, "cv_string_set");
clixon_err(OE_UNIX, errno, "cv_string_set");
cv = NULL;
goto done;
}
if (cv_string_set(cv, val) == NULL){
clicon_err(OE_UNIX, errno, "cv_string_set");
clixon_err(OE_UNIX, errno, "cv_string_set");
cv = NULL;
goto done;
}