From: Jens Axboe Date: Tue, 7 Oct 2014 15:09:57 +0000 (-0600) Subject: exp: fix issues around int vs size_t X-Git-Tag: fio-2.1.14~91 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=3fcc6ca7f15db70b9f82df1f9065765b4cca4e9d exp: fix issues around int vs size_t This seems to be the easiest way - just wrap the call in a macro that always passes a size_t, then it doesn't matter what yy_n_chars is typed as (int or size_t). Signed-off-by: Jens Axboe --- diff --git a/exp/expression-parser.l b/exp/expression-parser.l index 7d5e787d..d659c4f3 100644 --- a/exp/expression-parser.l +++ b/exp/expression-parser.l @@ -24,11 +24,17 @@ #define YYSTYPE PARSER_VALUE_TYPE -extern int lexer_input(char* buffer, int *nbytes, int buffersize); +extern int lexer_input(char* buffer, size_t *nbytes, int buffersize); #undef YY_INPUT -#define YY_INPUT(buffer, bytes_read, bytes_requested) \ - lexer_input((buffer), &(bytes_read), (bytes_requested)) +#define YY_INPUT(buffer, bytes_read, bytes_requested) \ +({ \ + int __ret; \ + size_t __bread = bytes_read; \ + __ret = lexer_input((buffer), &__bread, (bytes_requested)); \ + bytes_read = __bread; \ + __ret; \ +}) extern int yyerror(long long *result, double *dresult, int *has_error, int *units_specified, const char *msg);