Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Mar 2011 13:27:13 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r219306 - head/bin/sh
Message-ID:  <201103051327.p25DRDh6058612@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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':



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103051327.p25DRDh6058612>