Fixed JSON unbalanced braces resultin assert

This commit is contained in:
Olof hagsand 2018-05-06 21:06:52 +02:00
parent 697c021d49
commit 4257999df5
6 changed files with 29 additions and 20 deletions

View file

@ -102,7 +102,8 @@ static struct errvec EV[] = {
};
static char *
clicon_strerror1(int err, struct errvec vec[])
clicon_strerror1(int err,
struct errvec vec[])
{
struct errvec *ev;
@ -142,10 +143,10 @@ clicon_err_reset(void)
*/
int
clicon_err_fn(const char *fn,
const int line,
int category,
int suberr,
char *reason, ...)
const int line,
int category,
int suberr,
char *reason, ...)
{
va_list args;
int len;

View file

@ -792,7 +792,8 @@ usage(char *argv0)
}
int
main(int argc, char **argv)
main(int argc,
char **argv)
{
cxobj *xt;
cxobj *xc;

View file

@ -101,7 +101,7 @@ object.
/* typecast macro */
#define _JY ((struct clicon_json_yacc_arg *)_jy)
#define _YYERROR(msg) {clicon_debug(2, "YYERROR %s '%s' %d", (msg), clixon_json_parsetext, _JY->jy_linenum); YYERROR;}
#define _YYERROR(msg) {clicon_err(OE_XML, 0, "YYERROR %s '%s' %d", (msg), clixon_json_parsetext, _JY->jy_linenum); YYERROR;}
/* add _yy to error paramaters */
#define YY_(msgid) msgid
@ -139,7 +139,8 @@ extern int clixon_json_parseget_lineno (void);
*/
void
clixon_json_parseerror(void *_jy, char *s)
clixon_json_parseerror(void *_jy,
char *s)
{
clicon_err(OE_XML, 0, "%s on line %d: %s at or before: '%s'",
_JY->jy_name,
@ -192,7 +193,10 @@ json_current_clone(struct clicon_json_yacc_arg *jy)
{
cxobj *xn;
assert(xn = jy->jy_current);
if (jy->jy_current == NULL){
return -1;
}
xn = jy->jy_current;
json_current_pop(jy);
if (jy->jy_current)
json_current_new(jy, xml_name(xn));
@ -258,7 +262,7 @@ array : '[' ']'
;
valuelist : value
| valuelist { json_current_clone(_JY);} ',' value
| valuelist { if (json_current_clone(_JY)< 0) _YYERROR("stack?");} ',' value
;
/* quoted string */

View file

@ -157,13 +157,12 @@ slogtime(void)
/*! Make a logging call to syslog (or stderr).
*
* This is the _only_ place the actual syslog (or stderr) logging is made in clicon,..
* @note syslog makes itw own filtering, but if log to stderr we do it here
* @see clicon_debug()
*
* @param[in] level log level, eg LOG_DEBUG,LOG_INFO,...,LOG_EMERG. Thisis OR:d with facility == LOG_USER
* @param[in] msg Message to print as argv.
* This is the _only_ place the actual syslog (or stderr) logging is made in clicon,..
* @note syslog makes itw own filtering, but if log to stderr we do it here
* @see clicon_debug
*/
int
clicon_log_str(int level,
@ -214,13 +213,13 @@ clicon_log_str(int level,
/*! Make a logging call to syslog using variable arg syntax.
*
* See also clicon_log_init() and clicon_log_str()
*
* @param[in] level log level, eg LOG_DEBUG,LOG_INFO,...,LOG_EMERG. This
* is OR:d with facility == LOG_USER
* @param[in] format Message to print as argv.
* @code
clicon_log(LOG_NOTICE, "%s: dump to dtd not supported", __PROGRAM__);
* @endcode
* @param[in] level log level, eg LOG_DEBUG,LOG_INFO,...,LOG_EMERG. Thisis OR:d with facility == LOG_USER
* @param[in] format Message to print as argv.
* @see cicon_log_init and clicon_log_str
*/
int
clicon_log(int level,