From: Peter Avalos Date: Sat, 16 Apr 2011 21:10:07 +0000 (-1000) Subject: sh: Reduce diffs to FreeBSD in the arith code. X-Git-Tag: v2.11.0~33 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/cb26c088d93655d06e1b74351c815ae6fd0e57e9 sh: Reduce diffs to FreeBSD in the arith code. Obtained-from: FreeBSD --- diff --git a/bin/sh/arith_yacc.c b/bin/sh/arith_yacc.c index 666b191573..dd8a37368c 100644 --- a/bin/sh/arith_yacc.c +++ b/bin/sh/arith_yacc.c @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/bin/sh/arith_yacc.c,v 1.1 2011/02/08 23:18:06 jilles Exp $ + * $FreeBSD: src/bin/sh/arith_yacc.c,v 1.3 2011/03/05 13:27:13 jilles Exp $ */ #include @@ -204,7 +204,7 @@ again: } static arith_t -binop2(arith_t a, int op, int lprec, int noeval) +binop2(arith_t a, int op, int precedence, int noeval) { for (;;) { union yystype val; @@ -227,7 +227,7 @@ binop2(arith_t a, int op, int lprec, int noeval) a = noeval ? b : do_binop(op, a, b); if (op2 < ARITH_BINOP_MIN || op2 >= ARITH_BINOP_MAX || - arith_prec(op2) >= lprec) + arith_prec(op2) >= precedence) return a; op = op2; diff --git a/bin/sh/arith_yylex.c b/bin/sh/arith_yylex.c index 5452665322..2d62a55a4f 100644 --- a/bin/sh/arith_yylex.c +++ b/bin/sh/arith_yylex.c @@ -30,6 +30,8 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $FreeBSD: src/bin/sh/arith_yylex.c,v 1.3 2011/03/07 07:31:15 stefanf Exp $ */ #include @@ -54,6 +56,7 @@ yylex(void) { int value; const char *buf = arith_buf; + char *end; const char *p; for (;;) { @@ -76,8 +79,8 @@ yylex(void) case '7': case '8': case '9': - yylval.val = strtoarith_t(buf, - __DECONST(char **, &arith_buf), 0); + yylval.val = strtoarith_t(buf, &end, 0); + arith_buf = end; return ARITH_NUM; case 'A': case 'B':