File: 13_fix_arithmetic_precedence.diff

package info (click to toggle)
csh 20240808-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,324 kB
  • sloc: ansic: 11,699; makefile: 60; sh: 16
file content (51 lines) | stat: -rw-r--r-- 951 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Description: Fix arithmetic precedence for consecutive ADDOP or MULOP
Author: Gilles Filippini <pini@debian.org>
Bug-Debian: https://bugs.debian.org/862221
Last-Updated: 2021-09-29

--- a/exp.c
+++ b/exp.c
@@ -259,10 +259,10 @@
     int i = 0;
 
     p1 = exp5(vp, ignore);
-    if (isa(**vp, ADDOP)) {
+    while (isa(**vp, ADDOP)) {
 	Char *op = *(*vp)++;
 
-	p2 = exp4(vp, ignore);
+	p2 = exp5(vp, ignore);
 	if (!(ignore & IGNORE))
 	    switch (op[0]) {
 
@@ -276,7 +276,7 @@
 	    }
 	free(p1);
 	free(p2);
-	return (putn(i));
+	p1 = putn(i);
     }
     return (p1);
 }
@@ -288,10 +288,10 @@
     int i = 0, l;
 
     p1 = exp6(vp, ignore);
-    if (isa(**vp, MULOP)) {
+    while (isa(**vp, MULOP)) {
 	Char *op = *(*vp)++;
 
-	p2 = exp5(vp, ignore);
+	p2 = exp6(vp, ignore);
 	if (!(ignore & IGNORE))
 	    switch (op[0]) {
 
@@ -323,7 +323,7 @@
 	    }
 	free(p1);
 	free(p2);
-	return (putn(i));
+	p1 = putn(i);
     }
     return (p1);
 }