summaryrefslogtreecommitdiff
path: root/src/scan.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-09 15:50:21 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-09 15:50:21 +0200
commit795ffc5e62e8ba383575dbcd9943a580d4bd3358 (patch)
treec128889056202b255e2f22afeb7717894d350862 /src/scan.c
parent5fadc0cbb8577c61d66bd6f19ceaf0507c11e23b (diff)
formatting changes
Manual format adjustments. Comment adjustments. Remove usage of the register keyword.
Diffstat (limited to 'src/scan.c')
-rw-r--r--src/scan.c54
1 files changed, 27 insertions, 27 deletions
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;