Print this page
new smatch

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/smatch/src/smatch_conditions.c
          +++ new/usr/src/tools/smatch/src/smatch_conditions.c
↓ open down ↓ 70 lines elided ↑ open up ↑
  71   71                  return 1;
  72   72          return 0;
  73   73  }
  74   74  
  75   75  static int handle_zero_comparisons(struct expression *expr)
  76   76  {
  77   77          struct expression *tmp = NULL;
  78   78          struct expression *zero;
  79   79  
  80   80          // if left is zero or right is zero
  81      -        if (is_zero(expr->left)) {
       81 +        if (expr_is_zero(expr->left)) {
  82   82                  zero = strip_expr(expr->left);
  83   83                  if (zero->type != EXPR_VALUE)
  84   84                          __split_expr(expr->left);
  85   85                  tmp = expr->right;
  86      -        } else if (is_zero(expr->right)) {
       86 +        } else if (expr_is_zero(expr->right)) {
  87   87                  zero = strip_expr(expr->left);
  88   88                  if (zero->type != EXPR_VALUE)
  89   89                          __split_expr(expr->right);
  90   90                  tmp = expr->left;
  91   91          } else {
  92   92                  return 0;
  93   93          }
  94   94  
  95   95          // "if (foo != 0)" is the same as "if (foo)"
  96   96          if (expr->op == SPECIAL_NOTEQUAL) {
↓ open down ↓ 658 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX