From ec06b597a919df4c6f7896d61ee7decd746c4e36 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Mon, 28 Mar 2022 15:21:35 -0400 Subject: modernize bigoscan() --- big.c | 8 +++++--- 1 file 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; } -- cgit v1.2.1