diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-03-08 06:06:14 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-03-08 06:06:14 -0800 |
commit | 6d3bc46fbc374ce84569c6d906c36c30e196fff1 (patch) | |
tree | 982633a0f57cf81e0a3393d5e98bffefe563eff6 | |
parent | 24fb5194ad18da2c25f969d288777c881f28d4d6 (diff) | |
download | txr-6d3bc46fbc374ce84569c6d906c36c30e196fff1.tar.gz txr-6d3bc46fbc374ce84569c6d906c36c30e196fff1.tar.bz2 txr-6d3bc46fbc374ce84569c6d906c36c30e196fff1.zip |
code review: switch case breaks.
* arith.c (c_unum): Add fallthrough comment.
(minus): Add missing break after case that handles char minus
heap object.. This luckily isn't a bug because type(anum)
isn't RNG, and so when it falls through, the next case also
falls through.
* lib.c (car): Add missing fallthrough comment.
-rw-r--r-- | arith.c | 3 | ||||
-rw-r--r-- | lib.c | 1 |
2 files changed, 4 insertions, 0 deletions
@@ -174,6 +174,7 @@ ucnum c_unum(val num) mp_get_uintptr(mp(num), &out); return out; } + /* fallthrough */ range: uw_throwf(error_s, lit("~s given, non-negative expected"), num, nao); default: @@ -680,9 +681,11 @@ tail: case TAG_PAIR(TAG_CHR, TAG_PTR): if (type(bnum) == RNG) return rcons(minus(anum, from(bnum)), minus(anum, to(bnum))); + break; case TAG_PAIR(TAG_PTR, TAG_CHR): if (type(anum) == RNG) return rcons(minus(from(anum), bnum), minus(to(anum), bnum)); + break; } uw_throwf(error_s, lit("-: invalid operands ~s ~s"), anum, bnum, nao); } @@ -392,6 +392,7 @@ val car(val cons) return funcall2(lambda_meth, cons, zero); } } + /* fallthrough */ default: type_mismatch(lit("car: ~s is not a cons"), cons, nao); } |