aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2017-08-16 23:08:03 +0200
committerAndy Polyakov <appro@openssl.org>2017-08-18 09:24:52 +0200
commit8909c2ceeee2c1683f783d905f975bca8626ad33 (patch)
tree8fbaa17c92bfd459e51b0be086d6cd2c02544946
parentd3d880ce01cfaf0091f46a2f6b5bd146d47a93e7 (diff)
downloadopenssl-8909c2ceeee2c1683f783d905f975bca8626ad33.tar.gz
err/err.c: improve readability.
Reviewed-by: Rich Salz <rsalz@openssl.org>
-rw-r--r--crypto/err/err.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/crypto/err/err.c b/crypto/err/err.c
index 8d0da79f30..eec071236e 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -800,9 +800,7 @@ int ERR_pop_to_mark(void)
while (es->bottom != es->top
&& (es->err_flags[es->top] & ERR_FLAG_MARK) == 0) {
err_clear(es, es->top);
- es->top -= 1;
- if (es->top == -1)
- es->top = ERR_NUM_ERRORS - 1;
+ es->top = es->top > 0 ? es->top - 1 : ERR_NUM_ERRORS - 1;
}
if (es->bottom == es->top)
@@ -823,9 +821,7 @@ int ERR_clear_last_mark(void)
top = es->top;
while (es->bottom != top
&& (es->err_flags[top] & ERR_FLAG_MARK) == 0) {
- top -= 1;
- if (top == -1)
- top = ERR_NUM_ERRORS - 1;
+ top = top > 0 ? top - 1 : ERR_NUM_ERRORS - 1;
}
if (es->bottom == top)