commit 29b8cb7c38ed9c8cdbf1dddfdde3f2cfa25f763f parent c6392def816e6f93c59e323b777d3aebb4a385c5 Author: sin <sin@2f30.org> Date: Thu, 17 Dec 2015 15:57:52 +0000 Simplify parseint() Diffstat:
M | ben.c | | | 12 | +++--------- |
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/ben.c b/ben.c @@ -70,18 +70,12 @@ parseint(char *s, char *e, struct ben **b) if (++p == e) error("bad integer"); - switch (*p) { - case '-': + if (*p == '-') isneg = 1; - break; - case '0': - /* i0e is the only valid representation of zero */ + else if (*p == '0') iszero = 1; - break; - default: + else p--; - break; - } v = 0; while (1) {