|
| 1 | +--- src/lib/libast/string/strexpr.c.orig 2017-11-30 22:35:04 UTC |
| 2 | ++++ src/lib/libast/string/strexpr.c |
| 3 | +@@ -44,7 +44,7 @@ |
| 4 | + #define peekchr(ex) (*(ex)->nextchr) |
| 5 | + #define ungetchr(ex) ((ex)->nextchr--) |
| 6 | + |
| 7 | +-#define error(ex,msg) return(seterror(ex,msg)) |
| 8 | ++#define err(ex,msg) return(seterror(ex,msg)) |
| 9 | + |
| 10 | + typedef struct /* expression handle */ |
| 11 | + { |
| 12 | +@@ -87,7 +87,7 @@ expr(register Expr_t* ex, register int p |
| 13 | + case 0: |
| 14 | + ungetchr(ex); |
| 15 | + if (!precedence) return(0); |
| 16 | +- error(ex, "more tokens expected"); |
| 17 | ++ err(ex, "more tokens expected"); |
| 18 | + case '-': |
| 19 | + n = -expr(ex, 13); |
| 20 | + break; |
| 21 | +@@ -113,17 +113,17 @@ expr(register Expr_t* ex, register int p |
| 22 | + case 0: |
| 23 | + goto done; |
| 24 | + case ')': |
| 25 | +- if (!precedence) error(ex, "too many )'s"); |
| 26 | ++ if (!precedence) err(ex, "too many )'s"); |
| 27 | + goto done; |
| 28 | + case '(': |
| 29 | + n = expr(ex, 1); |
| 30 | + if (getchr(ex) != ')') |
| 31 | + { |
| 32 | + ungetchr(ex); |
| 33 | +- error(ex, "closing ) expected"); |
| 34 | ++ err(ex, "closing ) expected"); |
| 35 | + } |
| 36 | + gotoperand: |
| 37 | +- if (operand) error(ex, "operator expected"); |
| 38 | ++ if (operand) err(ex, "operator expected"); |
| 39 | + operand = 1; |
| 40 | + continue; |
| 41 | + case '?': |
| 42 | +@@ -140,7 +140,7 @@ expr(register Expr_t* ex, register int p |
| 43 | + if (getchr(ex) != ':') |
| 44 | + { |
| 45 | + ungetchr(ex); |
| 46 | +- error(ex, ": expected for ? operator"); |
| 47 | ++ err(ex, ": expected for ? operator"); |
| 48 | + } |
| 49 | + if (n) |
| 50 | + { |
| 51 | +@@ -189,7 +189,7 @@ expr(register Expr_t* ex, register int p |
| 52 | + break; |
| 53 | + case '=': |
| 54 | + case '!': |
| 55 | +- if (peekchr(ex) != '=') error(ex, "operator syntax error"); |
| 56 | ++ if (peekchr(ex) != '=') err(ex, "operator syntax error"); |
| 57 | + if (precedence > 7) goto done; |
| 58 | + getchr(ex); |
| 59 | + x = expr(ex, 8); |
| 60 | +@@ -237,7 +237,7 @@ expr(register Expr_t* ex, register int p |
| 61 | + if (precedence > 11) goto done; |
| 62 | + x = expr(ex, 12); |
| 63 | + if (c == '*') n *= x; |
| 64 | +- else if (x == 0) error(ex, "divide by zero"); |
| 65 | ++ else if (x == 0) err(ex, "divide by zero"); |
| 66 | + else if (c == '/') n /= x; |
| 67 | + else n %= x; |
| 68 | + break; |
| 69 | +@@ -246,15 +246,15 @@ expr(register Expr_t* ex, register int p |
| 70 | + pos = --ex->nextchr; |
| 71 | + if (isdigit(c)) n = strton(ex->nextchr, &ex->nextchr, NiL, 0); |
| 72 | + else if (ex->convert) n = (*ex->convert)(ex->nextchr, &ex->nextchr, ex->handle); |
| 73 | +- if (ex->nextchr == pos) error(ex, "syntax error"); |
| 74 | ++ if (ex->nextchr == pos) err(ex, "syntax error"); |
| 75 | + goto gotoperand; |
| 76 | + } |
| 77 | + if (ex->errmsg) return(0); |
| 78 | +- if (!operand) error(ex, "operand expected"); |
| 79 | ++ if (!operand) err(ex, "operand expected"); |
| 80 | + } |
| 81 | + done: |
| 82 | + ungetchr(ex); |
| 83 | +- if (!operand) error(ex, "operand expected"); |
| 84 | ++ if (!operand) err(ex, "operand expected"); |
| 85 | + return(n); |
| 86 | + } |
| 87 | + |
0 commit comments