Change comment style and use errx instead of err

This commit is contained in:
ISSOtm
2020-04-13 02:50:11 +02:00
parent d21015e34a
commit 57639f3765

View File

@@ -85,14 +85,16 @@ static void pushRPN(int32_t value)
static const size_t increase_factor = 2; static const size_t increase_factor = 2;
if (stack.capacity > SIZE_MAX / increase_factor) if (stack.capacity > SIZE_MAX / increase_factor)
err(1, "Overflow in RPN stack resize"); errx(1, "Overflow in RPN stack resize");
stack.capacity *= increase_factor; stack.capacity *= increase_factor;
stack.buf = stack.buf =
realloc(stack.buf, sizeof(*stack.buf) * stack.capacity); realloc(stack.buf, sizeof(*stack.buf) * stack.capacity);
// || !stack.capacity to fix bogus /*
// zero-size allocation warning from * Static analysis tools complain that the capacity might become
// scan-build, already caught above * zero due to overflow, but fail to realize that it's caught by
* the overflow check above. Hence the stringent check below.
*/
if (!stack.buf || !stack.capacity) if (!stack.buf || !stack.capacity)
err(1, "Failed to resize RPN stack"); err(1, "Failed to resize RPN stack");
} }