C-style update: Unified comment, retvals in order, remove trailing spaces

Changed function name for `clicon_debug` functions
This commit is contained in:
Olof hagsand 2023-10-22 18:04:47 +02:00
parent 6e314dd96f
commit 62348fc9c7
204 changed files with 6047 additions and 4904 deletions

View file

@ -77,7 +77,7 @@
/* typecast macro */
#define _IF ((clixon_yang_sub_parse_yacc *)_if)
#define _YYERROR(msg) {clicon_err(OE_YANG, 0, "%s", (msg)); YYERROR;}
#include <stdio.h>
#include <stdint.h>
#include <string.h>
@ -105,29 +105,32 @@
/* Enable for debugging, steals some cycles otherwise */
#if 0
#define _PARSE_DEBUG(s) clicon_debug(1,(s))
#define _PARSE_DEBUG(s) clixon_debug(1,(s))
#else
#define _PARSE_DEBUG(s)
#endif
void
clixon_yang_sub_parseerror(void *arg,
char *s)
char *s)
{
clixon_yang_sub_parse_yacc *ife = (clixon_yang_sub_parse_yacc *)arg;
clicon_err_fn(NULL, 0, OE_YANG, 0, "yang_sub_parse: file:%s:%d \"%s\" %s: at or before: %s",
ife->if_mainfile,
ife->if_linenum,
ife->if_parse_string,
s,
clixon_yang_sub_parsetext);
clicon_err_fn(NULL, 0, OE_YANG, 0, "yang_sub_parse: file:%s:%d \"%s\" %s: at or before: %s",
ife->if_mainfile,
ife->if_linenum,
ife->if_parse_string,
s,
clixon_yang_sub_parsetext);
return;
}
/*! Check if feature "str" is enabled or not in context of yang node ys
*
* @param[in] str feature str.
* @param[in] ys If-feature type yang node
* @retval 0 OK
* @retval -1 Error
*/
static int
if_feature_check(clixon_yang_sub_parse_yacc *ife,
@ -140,7 +143,7 @@ if_feature_check(clixon_yang_sub_parse_yacc *ife,
yang_stmt *yfeat; /* feature yang node */
cg_var *cv;
yang_stmt *ys;
if ((ys = ife->if_ys) == NULL)
return 0;
if (nodeid_split(str, &prefix, &feature) < 0)
@ -179,9 +182,9 @@ if_feature_check(clixon_yang_sub_parse_yacc *ife,
free(feature);
return retval;
}
%}
%}
%%
/* See RFC 7950 Sec 14 if-feature-expr-str */
@ -193,7 +196,7 @@ top : if_feature_expr MY_EOF
YYACCEPT;
}
else{
_YYERROR("Expected if-feature-expr");
_YYERROR("Expected if-feature-expr");
}
}
;