diff options
author | Jakob Kaivo <jkk@ung.org> | 2022-03-28 15:21:35 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2022-03-28 15:21:35 -0400 |
commit | ec06b597a919df4c6f7896d61ee7decd746c4e36 (patch) | |
tree | 01a2620ad86fd66d217042b5031548ae3a08e3fc /big.c | |
parent | fb2877deb18d583791c1d10d43a26822eb2574f7 (diff) |
modernize bigoscan()
Diffstat (limited to 'big.c')
-rw-r--r-- | big.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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; } |