svn commit: r219306 - head/bin/sh

Jilles Tjoelker jilles at FreeBSD.org
Sat Mar 5 13:27:13 UTC 2011


Author: jilles
Date: Sat Mar  5 13:27:13 2011
New Revision: 219306
URL: http://svn.freebsd.org/changeset/base/219306

Log:
  sh: Fix some warnings in code for arithmetic expressions.
  
  Submitted by:	eadler

Modified:
  head/bin/sh/arith_yacc.c
  head/bin/sh/arith_yylex.c

Modified: head/bin/sh/arith_yacc.c
==============================================================================
--- head/bin/sh/arith_yacc.c	Sat Mar  5 12:46:24 2011	(r219305)
+++ head/bin/sh/arith_yacc.c	Sat Mar  5 13:27:13 2011	(r219306)
@@ -198,7 +198,7 @@ again:
 	}
 }
 
-static arith_t binop2(arith_t a, int op, int prec, int noeval)
+static arith_t binop2(arith_t a, int op, int precedence, int noeval)
 {
 	for (;;) {
 		union yystype val;
@@ -221,7 +221,7 @@ static arith_t binop2(arith_t a, int op,
 		a = noeval ? b : do_binop(op, a, b);
 
 		if (op2 < ARITH_BINOP_MIN || op2 >= ARITH_BINOP_MAX ||
-		    arith_prec(op2) >= prec)
+		    arith_prec(op2) >= precedence)
 			return a;
 
 		op = op2;

Modified: head/bin/sh/arith_yylex.c
==============================================================================
--- head/bin/sh/arith_yylex.c	Sat Mar  5 12:46:24 2011	(r219305)
+++ head/bin/sh/arith_yylex.c	Sat Mar  5 13:27:13 2011	(r219306)
@@ -57,6 +57,7 @@ yylex()
 {
 	int value;
 	const char *buf = arith_buf;
+	char *end;
 	const char *p;
 
 	for (;;) {
@@ -79,7 +80,8 @@ yylex()
 		case '7':
 		case '8':
 		case '9':
-			yylval.val = strtoarith_t(buf, (char **)&arith_buf, 0);
+			yylval.val = strtoarith_t(buf, (char **)&end, 0);
+			arith_buf = end;
 			return ARITH_NUM;
 		case 'A':
 		case 'B':


More information about the svn-src-all mailing list