From 442a306a60d4529f5cae70c0a659b4bc31d2f07b Mon Sep 17 00:00:00 2001 From: Haru Date: Fri, 18 Sep 2015 17:33:58 +0200 Subject: Clarified intent in various side-effect assignments While this doesn't change anything in the way those assignments work, it clarifies that they're intended to be side-effect assignments and not typos (to both human readers and static analyzers) Signed-off-by: Haru --- src/map/script.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/map/script.c') diff --git a/src/map/script.c b/src/map/script.c index dc0edcb01..35142a4f5 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -978,8 +978,8 @@ const char* parse_variable(const char* p) const char *p2 = NULL; const char *var = p; - if( ( p[0] == '+' && p[1] == '+' && (type = C_ADD_PRE) ) // pre ++ - || ( p[0] == '-' && p[1] == '-' && (type = C_SUB_PRE) ) // pre -- + if( ( p[0] == '+' && p[1] == '+' && (type = C_ADD_PRE, true) ) // pre ++ + || ( p[0] == '-' && p[1] == '-' && (type = C_SUB_PRE, true) ) // pre -- ) { var = p = script->skip_space(&p[2]); } @@ -1008,19 +1008,19 @@ const char* parse_variable(const char* p) } if( type == C_NOP && - !( ( p[0] == '=' && p[1] != '=' && (type = C_EQ) ) // = - || ( p[0] == '+' && p[1] == '=' && (type = C_ADD) ) // += - || ( p[0] == '-' && p[1] == '=' && (type = C_SUB) ) // -= - || ( p[0] == '^' && p[1] == '=' && (type = C_XOR) ) // ^= - || ( p[0] == '|' && p[1] == '=' && (type = C_OR ) ) // |= - || ( p[0] == '&' && p[1] == '=' && (type = C_AND) ) // &= - || ( p[0] == '*' && p[1] == '=' && (type = C_MUL) ) // *= - || ( p[0] == '/' && p[1] == '=' && (type = C_DIV) ) // /= - || ( p[0] == '%' && p[1] == '=' && (type = C_MOD) ) // %= - || ( p[0] == '+' && p[1] == '+' && (type = C_ADD_POST) ) // post ++ - || ( p[0] == '-' && p[1] == '-' && (type = C_SUB_POST) ) // post -- - || ( p[0] == '<' && p[1] == '<' && p[2] == '=' && (type = C_L_SHIFT) ) // <<= - || ( p[0] == '>' && p[1] == '>' && p[2] == '=' && (type = C_R_SHIFT) ) // >>= + !( ( p[0] == '=' && p[1] != '=' && (type = C_EQ, true) ) // = + || ( p[0] == '+' && p[1] == '=' && (type = C_ADD, true) ) // += + || ( p[0] == '-' && p[1] == '=' && (type = C_SUB, true) ) // -= + || ( p[0] == '^' && p[1] == '=' && (type = C_XOR, true) ) // ^= + || ( p[0] == '|' && p[1] == '=' && (type = C_OR, true) ) // |= + || ( p[0] == '&' && p[1] == '=' && (type = C_AND, true) ) // &= + || ( p[0] == '*' && p[1] == '=' && (type = C_MUL, true) ) // *= + || ( p[0] == '/' && p[1] == '=' && (type = C_DIV, true) ) // /= + || ( p[0] == '%' && p[1] == '=' && (type = C_MOD, true) ) // %= + || ( p[0] == '+' && p[1] == '+' && (type = C_ADD_POST, true) ) // post ++ + || ( p[0] == '-' && p[1] == '-' && (type = C_SUB_POST, true) ) // post -- + || ( p[0] == '<' && p[1] == '<' && p[2] == '=' && (type = C_L_SHIFT, true) ) // <<= + || ( p[0] == '>' && p[1] == '>' && p[2] == '=' && (type = C_R_SHIFT, true) ) // >>= ) ) {// failed to find a matching operator combination so invalid return NULL; -- cgit v1.2.3-60-g2f50