summaryrefslogtreecommitdiff
path: root/main/ast_expr2.fl
diff options
context:
space:
mode:
authorWalter Doekes <walter+asterisk@wjd.nu>2012-02-08 20:49:48 +0000
committerWalter Doekes <walter+asterisk@wjd.nu>2012-02-08 20:49:48 +0000
commitdb24fc2523da16bd812abb2a35b6320d24083e3f (patch)
tree4f4d564d4c32538014aefd01789f3f2bffc5520e /main/ast_expr2.fl
parent0adeb88318467f75f84a70990b1f982b9ca470f3 (diff)
Avoid cppcheck warnings; removing unused vars and a bit of cleanup.
Patch by: Clod Patry Review: https://reviewboard.asterisk.org/r/1651 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354429 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/ast_expr2.fl')
-rw-r--r--main/ast_expr2.fl43
1 files changed, 23 insertions, 20 deletions
diff --git a/main/ast_expr2.fl b/main/ast_expr2.fl
index 624618e9f..5c7e6a549 100644
--- a/main/ast_expr2.fl
+++ b/main/ast_expr2.fl
@@ -437,35 +437,38 @@ static char *expr2_token_subst(const char *mess)
}
int ast_yyerror (const char *s, yyltype *loc, struct parse_io *parseio )
-{
+{
struct yyguts_t * yyg = (struct yyguts_t*)(parseio->scanner);
char spacebuf[8000]; /* best safe than sorry */
- char spacebuf2[8000]; /* best safe than sorry */
int i=0;
char *s2 = expr2_token_subst(s);
spacebuf[0] = 0;
-
- for(i=0;i< (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf);i++) spacebuf2[i] = ' '; /* uh... assuming yyg is defined, then I can use the yycolumn macro,
- which is the same thing as... get this:
- yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]->yy_bs_column
- I was tempted to just use yy_buf_pos in the STATE, but..., well:
- a. the yy_buf_pos is the current position in the buffer, which
- may not relate to the entire string/buffer because of the
- buffering.
- b. but, analysis of the situation is that when you use the
- yy_scan_string func, it creates a single buffer the size of
- string, so the two would be the same...
- so, in the end, the yycolumn macro is available, shorter, therefore easier. */
- spacebuf2[i++]='^';
- spacebuf2[i]= 0;
+
+ for (i = 0; i < (int)(yytext - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf); i++) {
+ spacebuf[i] = ' ';
+ }
+ /* uh... assuming yyg is defined, then I can use the yycolumn macro,
+ which is the same thing as... get this:
+ yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]->yy_bs_column
+ I was tempted to just use yy_buf_pos in the STATE, but..., well:
+ a. the yy_buf_pos is the current position in the buffer, which
+ may not relate to the entire string/buffer because of the
+ buffering.
+ b. but, analysis of the situation is that when you use the
+ yy_scan_string func, it creates a single buffer the size of
+ string, so the two would be the same...
+ so, in the end, the yycolumn macro is available, shorter, therefore easier. */
+
+ spacebuf[i++] = '^';
+ spacebuf[i] = 0;
#ifdef STANDALONE3
/* easier to read in the standalone version */
- printf("ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",
- (extra_error_message_supplied?extra_error_message:""), s2, parseio->string,spacebuf2);
+ printf("ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",
+ (extra_error_message_supplied ? extra_error_message : ""), s2, parseio->string, spacebuf);
#else
- ast_log(LOG_WARNING,"ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",
- (extra_error_message_supplied?extra_error_message:""), s2, parseio->string,spacebuf2);
+ ast_log(LOG_WARNING,"ast_yyerror(): %s syntax error: %s; Input:\n%s\n%s\n",
+ (extra_error_message_supplied ? extra_error_message : ""), s2, parseio->string, spacebuf);
#endif
#ifndef STANDALONE
ast_log(LOG_WARNING,"If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables\n");