summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2022-03-28 15:21:35 -0400
committerJakob Kaivo <jkk@ung.org>2022-03-28 15:21:35 -0400
commitec06b597a919df4c6f7896d61ee7decd746c4e36 (patch)
tree01a2620ad86fd66d217042b5031548ae3a08e3fc
parentfb2877deb18d583791c1d10d43a26822eb2574f7 (diff)
modernize bigoscan()
-rw-r--r--big.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/big.c b/big.c
index 642f4b2..8a563e7 100644
--- a/big.c
+++ b/big.c
@@ -791,12 +791,13 @@ word bigxscan(char *p, char *q)
return r;
}
-word bigoscan(p, q) /* read unsigned octal number in '\0'-terminated string p to q */
- /* assumes redundant leading zeros removed */
-char *p, *q;
+/* read unsigned octal number in '\0'-terminated string p to q */
+/* assumes redundant leading zeros removed */
+word bigoscan(char *p, char *q)
{
word r; /* will hold result */
word *x = &r;
+
while (q > p) {
unsigned hold;
q = q - p < 5 ? p : q - 5; /* read (upto) 5 octal digits from small end */
@@ -804,6 +805,7 @@ char *p, *q;
*q = '\0';
*x = make(INT, hold, 0), x = &rest(*x);
}
+
return r;
}