From 795ffc5e62e8ba383575dbcd9943a580d4bd3358 Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Tue, 9 Jul 2024 15:50:21 +0200 Subject: formatting changes Manual format adjustments. Comment adjustments. Remove usage of the register keyword. --- src/scan.c | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'src/scan.c') diff --git a/src/scan.c b/src/scan.c index 4d6b918..da271f3 100644 --- a/src/scan.c +++ b/src/scan.c @@ -1,10 +1,10 @@ #include "scan.h" /** - @file scan.c - @author djb - @source qmail, ucspi-tcp - @brief scanning/conversion of strings to different variable types + @file scan.c + @author djb + @source qmail, ucspi-tcp + @brief scanning/conversion of strings to different variable types */ static long int fromhex(unsigned char c) @@ -18,11 +18,11 @@ static long int fromhex(unsigned char c) return -1; } -unsigned int scan_0x(register const char *s, register unsigned int *u) +unsigned int scan_0x(const char *s, unsigned int *u) { - register unsigned int pos = 0; - register unsigned long result = 0; - register long int c; + unsigned int pos = 0; + unsigned long result = 0; + long int c; while ((c = fromhex((unsigned char)(s[pos]))) >= 0) { result = (result << 4) + c; @@ -32,11 +32,11 @@ unsigned int scan_0x(register const char *s, register unsigned int *u) return pos; } -unsigned int scan_8long(register const char *s, register unsigned long *u) +unsigned int scan_8long(const char *s, unsigned long *u) { - register unsigned int pos = 0; - register unsigned long result = 0; - register unsigned long c; + unsigned int pos = 0; + unsigned long result = 0; + unsigned long c; while ((c = (unsigned long)(unsigned char)(s[pos] - '0')) < 8) { result = result * 8 + c; @@ -46,9 +46,9 @@ unsigned int scan_8long(register const char *s, register unsigned long *u) return pos; } -unsigned int scan_uint(register const char *s, register unsigned int *u) +unsigned int scan_uint(const char *s, unsigned int *u) { - register unsigned int pos; + unsigned int pos; unsigned long result; pos = scan_ulong(s, &result); @@ -56,7 +56,7 @@ unsigned int scan_uint(register const char *s, register unsigned int *u) return pos; } -unsigned int scan_plusminus(register const char *s, register int *sign) +static unsigned int scan_plusminus(const char *s, int *sign) { if (*s == '+') { *sign = 1; @@ -70,11 +70,11 @@ unsigned int scan_plusminus(register const char *s, register int *sign) return 0; } -unsigned int scan_long(register const char *s, register long *i) +unsigned int scan_long(const char *s, long *i) { int sign; unsigned long u; - register unsigned int len; + unsigned int len; len = scan_plusminus(s, &sign); s += len; @@ -87,11 +87,11 @@ unsigned int scan_long(register const char *s, register long *i) } -unsigned int scan_ulong(register const char *s, register unsigned long *u) +unsigned int scan_ulong(const char *s, unsigned long *u) { - register unsigned int pos = 0; - register unsigned long result = 0; - register unsigned long c; + unsigned int pos = 0; + unsigned long result = 0; + unsigned long c; while ((c = (unsigned long)(unsigned char)(s[pos] - '0')) < 10) { result = result * 10 + c; @@ -103,9 +103,9 @@ unsigned int scan_ulong(register const char *s, register unsigned long *u) unsigned int scan_xlong(const char *s, unsigned long *u) { - register const char *t = s; - register int l = 0; - register unsigned char c; + const char *t = s; + int l = 0; + unsigned char c; while ((c = fromhex(*t)) < 16) { l = (l << 4) + c; @@ -117,9 +117,9 @@ unsigned int scan_xlong(const char *s, unsigned long *u) unsigned int scan_xint(const char *s, unsigned int *i) { - register const char *t = s; - register unsigned int l = 0; - register unsigned char c; + const char *t = s; + unsigned int l = 0; + unsigned char c; while ((l >> (sizeof(l) * 8 - 4)) == 0 && (c = (unsigned char)fromhex((unsigned char)*t)) < 16) { l = (l << 4) + c; -- cgit v1.2.3