From f128b10ddf2f65220037b7afd29f2297c70cc4a6 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sat, 29 Jun 2013 13:01:41 +0200 Subject: [PATCH] isl_input.c: extract out set_current_line_col Signed-off-by: Sven Verdoolaege --- isl_input.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/isl_input.c b/isl_input.c index b6d3880f..533a4fc9 100644 --- a/isl_input.c +++ b/isl_input.c @@ -702,6 +702,21 @@ error: return NULL; } +/* Set *line and *col to those of the next token, if any. + */ +static void set_current_line_col(struct isl_stream *s, int *line, int *col) +{ + struct isl_token *tok; + + tok = isl_stream_next_token(s); + if (!tok) + return; + + *line = tok->line; + *col = tok->col; + isl_stream_push_token(s, tok); +} + /* Accept an affine expression that may involve ternary operators. * We first read an affine expression. * If it is not followed by a comparison operator, we simply return it. @@ -718,12 +733,7 @@ static __isl_give isl_pw_aff *accept_extended_affine(struct isl_stream *s, int line = -1, col = -1; int is_comp; - tok = isl_stream_next_token(s); - if (tok) { - line = tok->line; - col = tok->col; - isl_stream_push_token(s, tok); - } + set_current_line_col(s, &line, &col); pwaff = accept_affine(s, dim, v); if (rational) -- 2.11.4.GIT