summaryrefslogtreecommitdiff
path: root/src/byte.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/byte.c')
-rw-r--r--src/byte.c46
1 files changed, 19 insertions, 27 deletions
diff --git a/src/byte.c b/src/byte.c
index e113cc3..51f18e1 100644
--- a/src/byte.c
+++ b/src/byte.c
@@ -1,18 +1,16 @@
#include "byte.h"
/**
- @file byte.c
- @author djb
- @brief byte manipulation functions
+ @file byte.c
+ @author djb
+ @brief byte manipulation functions
*/
-unsigned int byte_chr(char *s, register unsigned int n, int c)
+unsigned int byte_chr(char *s, unsigned int n, int c)
{
- register char ch;
- register char *t;
+ char ch = c;
+ char *t = s;
- ch = c;
- t = s;
for (;;) {
// clang-format off
if (!n) { break; } if (*t == ch) { break; } ++t; --n;
@@ -24,7 +22,7 @@ unsigned int byte_chr(char *s, register unsigned int n, int c)
return t - s;
}
-void byte_copy(register char *to, register unsigned int n, register char *from)
+void byte_copy(char *to, unsigned int n, char *from)
{
for (;;) {
// clang-format off
@@ -36,7 +34,7 @@ void byte_copy(register char *to, register unsigned int n, register char *from)
}
}
-void byte_copyr(register char *to, register unsigned int n, register char *from)
+void byte_copyr(char *to, unsigned int n, char *from)
{
to += n;
from += n;
@@ -51,7 +49,7 @@ void byte_copyr(register char *to, register unsigned int n, register char *from)
}
}
-int byte_diff(register char *s, register unsigned int n, register char *t)
+int byte_diff(char *s, unsigned int n, char *t)
{
for (;;) {
// clang-format off
@@ -64,30 +62,25 @@ int byte_diff(register char *s, register unsigned int n, register char *t)
return ((int)(unsigned int)(unsigned char)*s) - ((int)(unsigned int)(unsigned char)*t);
}
-unsigned int byte_rchr(char *s, register unsigned int n, int c)
+unsigned int byte_rchr(char *s, unsigned int n, int c)
{
- register char ch;
- register char *t;
- register char *u;
+ char ch = c;
+ char *t = s;
+ char *u = 0;
- ch = c;
- t = s;
- u = 0;
for (;;) {
// clang-format off
- if (!n) { break; } if (*t == ch) { u = t; } ++t; --n;
- if (!n) { break; } if (*t == ch) { u = t; } ++t; --n;
+ if (!n) { break; } if (*t == ch) { u = t; } ++t; --n;
+ if (!n) { break; } if (*t == ch) { u = t; } ++t; --n;
if (!n) { break; } if (*t == ch) { u = t; } ++t; --n;
if (!n) { break; } if (*t == ch) { u = t; } ++t; --n;
// clang-format on
}
- if (!u) {
- u = t;
- }
+ if (!u) u = t;
return u - s;
}
-void byte_zero(char *s, register unsigned int n)
+void byte_zero(char *s, unsigned int n)
{
for (;;) {
// clang-format off
@@ -99,11 +92,10 @@ void byte_zero(char *s, register unsigned int n)
}
}
-void byte_fill(char *s, register unsigned int n, const int c)
+void byte_fill(char *s, unsigned int n, int c)
{
- register char ch;
+ char ch = c;
- ch = c;
for (;;) {
// clang-format off
if (!n) { break; } *s++ = ch; --n;