[parsers] Use YYABORT instead of negative return

Seems return could lead to a memleak of yymsg
This commit is contained in:
ejurgensen 2022-01-31 00:44:29 +01:00
parent 410fa4b80e
commit 75c3590741
3 changed files with 11 additions and 11 deletions

View File

@ -425,8 +425,8 @@ static int result_set(struct daap_result *result, struct ast *a)
%%
query:
expr { return result_set(result, $1); }
| expr DAAP_T_NEWLINE { return result_set(result, $1); }
expr { if (result_set(result, $1) < 0) YYABORT; }
| expr DAAP_T_NEWLINE { if (result_set(result, $1) < 0) YYABORT; }
;
expr:

View File

@ -398,7 +398,7 @@ static int result_set(struct rsp_result *result, struct ast *a)
%%
query:
criteria { return result_set(result, $1); }
criteria { if (result_set(result, $1) < 0) YYABORT; }
;
criteria: criteria RSP_T_AND criteria { $$ = ast_new(RSP_T_AND, $1, $3); }

View File

@ -542,14 +542,14 @@ static int result_set(struct smartpl_result *result, char *title, struct ast *cr
%%
playlist:
SMARTPL_T_STRING '{' criteria having order limit '}' { return result_set(result, $1, $3, $4, $5, $6); }
| SMARTPL_T_STRING '{' criteria having order '}' { return result_set(result, $1, $3, $4, $5, NULL); }
| SMARTPL_T_STRING '{' criteria having limit '}' { return result_set(result, $1, $3, $4, NULL, $5); }
| SMARTPL_T_STRING '{' criteria having '}' { return result_set(result, $1, $3, $4, NULL, NULL); }
| SMARTPL_T_STRING '{' criteria order limit '}' { return result_set(result, $1, $3, NULL, $4, $5); }
| SMARTPL_T_STRING '{' criteria order '}' { return result_set(result, $1, $3, NULL, $4, NULL); }
| SMARTPL_T_STRING '{' criteria limit '}' { return result_set(result, $1, $3, NULL, NULL, $4); }
| SMARTPL_T_STRING '{' criteria '}' { return result_set(result, $1, $3, NULL, NULL, NULL); }
SMARTPL_T_STRING '{' criteria having order limit '}' { if (result_set(result, $1, $3, $4, $5, $6) < 0) YYABORT; }
| SMARTPL_T_STRING '{' criteria having order '}' { if (result_set(result, $1, $3, $4, $5, NULL) < 0) YYABORT; }
| SMARTPL_T_STRING '{' criteria having limit '}' { if (result_set(result, $1, $3, $4, NULL, $5) < 0) YYABORT; }
| SMARTPL_T_STRING '{' criteria having '}' { if (result_set(result, $1, $3, $4, NULL, NULL) < 0) YYABORT; }
| SMARTPL_T_STRING '{' criteria order limit '}' { if (result_set(result, $1, $3, NULL, $4, $5) < 0) YYABORT; }
| SMARTPL_T_STRING '{' criteria order '}' { if (result_set(result, $1, $3, NULL, $4, NULL) < 0) YYABORT; }
| SMARTPL_T_STRING '{' criteria limit '}' { if (result_set(result, $1, $3, NULL, NULL, $4) < 0) YYABORT; }
| SMARTPL_T_STRING '{' criteria '}' { if (result_set(result, $1, $3, NULL, NULL, NULL) < 0) YYABORT; }
;
criteria: criteria SMARTPL_T_AND criteria { $$ = ast_new(SMARTPL_T_AND, $1, $3); }