restored return value commit

This commit is contained in:
anon 2024-02-12 23:42:26 +01:00
parent a646916e93
commit f1ca33fa3a
2 changed files with 11 additions and 4 deletions

View File

@ -42,7 +42,7 @@ main(int ac, char **av)
psql_free(pstate);
if (!res) {
if (!res && !yyerrno) {
printf("{\"result\":true}\n");
return 0;
} else {

View File

@ -21,6 +21,7 @@
#include <string.h>
char *filename;
int yyerrno;
%}
%define api.pure
@ -31,6 +32,7 @@ char *filename;
%code requires {
extern char *filename;
extern int yyerrno;
#include "yyl.h"
@ -53,7 +55,7 @@ struct psql_state;
%token <strval> NAME
%token <strval> STRING
%token <intval> INTNUM
<intval> INTNUM
%token <intval> BOOL
%token <floatval> APPROXNUM
@ -327,7 +329,11 @@ void yyerror(YYLTYPE *, yyscan_t scanner, struct psql_state *pstate, const char
void lyyerror(YYLTYPE t, const char *s, ...);
%}
/* free discarded tokens */
%destructor { printf ("free at %d %s\n",@$.first_line, $$); free($$); } <strval>
%destructor {
#if DEBUG
printf ("free at %d %s\n",@$.first_line, $$); free($$);
#endif
} <strval>
%%
@ -974,7 +980,7 @@ yyerror(YYLTYPE *t, yyscan_t scanner, struct psql_state *pstate, const char *s,
t->last_line, t->last_column);
vfprintf(stderr, s, ap);
fprintf(stderr, "\n");
yyerrno = 1;
}
void
@ -988,5 +994,6 @@ lyyerror(YYLTYPE t, const char *s, ...)
t.last_line, t.last_column);
vfprintf(stderr, s, ap);
fprintf(stderr, "\n");
yyerrno = 1;
}