The function parse_printf_get_fmt() was allowed to return a customized version of its format_type argument but this is not really needed. So simplify the calling of this function. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- verify-format.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/verify-format.c b/verify-format.c index 753e59c167ce..1f5a2798dce4 100644 --- a/verify-format.c +++ b/verify-format.c @@ -234,8 +234,7 @@ static const char *check_printf_pointer(struct format_type *fmt, struct symbol * return NULL; } -static struct format_type *parse_printf_get_fmt(struct format_type *type, - const char *msg, const char **msgout) +static int parse_printf_get_fmt(struct format_type *type, const char *msg, const char **msgout) { const char *ptr = msg; int szmod = LEN_none; @@ -401,11 +400,8 @@ static struct format_type *parse_printf_get_fmt(struct format_type *type, break; } - if (type->test == NULL) - return NULL; - *msgout = ptr; - return type; + return type->test == NULL; } static int is_printf_flag(char ch) @@ -505,7 +501,6 @@ static int parse_format_printf(const char **fmtstring, struct expression_list *args) { struct format_type ftype; /* temp storage for format info */ - struct format_type *type; /* type found from the parse */ struct expression *expr; const char *fmt = *fmtstring; /* pointer to parse position */ const char *fmtpost = NULL; /* moved to end of the parsed format */ @@ -554,8 +549,8 @@ static int parse_format_printf(const char **fmtstring, error++; } - type = parse_printf_get_fmt(&ftype, fmt, &fmtpost); - if (type) { + ret = parse_printf_get_fmt(&ftype, fmt, &fmtpost); + if (!ret) { struct symbol *ctype; const char *typediff; @@ -574,7 +569,7 @@ static int parse_format_printf(const char **fmtstring, typediff = ftype.test(&ftype, ctype); if (typediff) { warning(expr->pos, "incorrect type in argument %d (%s)", pos, typediff); - info(expr->pos, " expected %s", show_typename(type->type)); + info(expr->pos, " expected %s", show_typename(ftype.type)); info(expr->pos, " got %s", show_typename(ctype)); } } else { -- 2.28.0