commit bea5a4e43bf3f20e3668978e4fd6e6d21e5547e8
parent b8d04d44542a23b1d348c0cf45430089effb921a
Author: Alan Post <adp@prgmr.com>
Date: Mon, 22 Jul 2019 08:25:25 -0600
remove register storage class declaration from codebase.
The register keyword is a storage class declaration, like extern or
static. It is a hint to the compiler that the variable will be
heavily used and can exist only in a hardware register, permitting it
to have no memory location.
Let the compiler make that decision.
Diffstat:
23 files changed, 73 insertions(+), 72 deletions(-)
diff --git a/CHANGES.md b/CHANGES.md
@@ -1,3 +1,4 @@
+- 20210122 code: remove register storage class declaration from codebase.
- 20201206 code: extend qmail-queue(8) interface so a custom rejection
message can be communicated to the caller.
- 20201120 code: add instqueue for packagers, extracted from instpackage.
diff --git a/byte_chr.c b/byte_chr.c
@@ -2,11 +2,11 @@
unsigned int byte_chr(s,n,c)
char *s;
-register unsigned int n;
+unsigned int n;
int c;
{
- register char ch;
- register char *t;
+ char ch;
+ char *t;
ch = c;
t = s;
diff --git a/byte_copy.c b/byte_copy.c
@@ -1,9 +1,9 @@
#include "byte.h"
void byte_copy(to,n,from)
-register char *to;
-register unsigned int n;
-register char *from;
+char *to;
+unsigned int n;
+char *from;
{
for (;;) {
if (!n) return; *to++ = *from++; --n;
diff --git a/byte_cr.c b/byte_cr.c
@@ -1,9 +1,9 @@
#include "byte.h"
void byte_copyr(to,n,from)
-register char *to;
-register unsigned int n;
-register char *from;
+char *to;
+unsigned int n;
+char *from;
{
to += n;
from += n;
diff --git a/byte_rchr.c b/byte_rchr.c
@@ -2,12 +2,12 @@
unsigned int byte_rchr(s,n,c)
char *s;
-register unsigned int n;
+unsigned int n;
int c;
{
- register char ch;
- register char *t;
- register char *u;
+ char ch;
+ char *t;
+ char *u;
ch = c;
t = s;
diff --git a/byte_zero.c b/byte_zero.c
@@ -2,7 +2,7 @@
void byte_zero(s,n)
char *s;
-register unsigned int n;
+unsigned int n;
{
for (;;) {
if (!n) break; *s++ = 0; --n;
diff --git a/case_diffb.c b/case_diffb.c
@@ -1,12 +1,12 @@
#include "case.h"
int case_diffb(s,len,t)
-register char *s;
+char *s;
unsigned int len;
-register char *t;
+char *t;
{
- register unsigned char x;
- register unsigned char y;
+ unsigned char x;
+ unsigned char y;
while (len > 0) {
--len;
diff --git a/case_diffs.c b/case_diffs.c
@@ -1,11 +1,11 @@
#include "case.h"
int case_diffs(s,t)
-register char *s;
-register char *t;
+char *s;
+char *t;
{
- register unsigned char x;
- register unsigned char y;
+ unsigned char x;
+ unsigned char y;
for (;;) {
x = *s++ - 'A';
diff --git a/case_starts.c b/case_starts.c
@@ -1,11 +1,11 @@
#include "case.h"
int case_starts(s,t)
-register char *s;
-register char *t;
+char *s;
+char *t;
{
- register unsigned char x;
- register unsigned char y;
+ unsigned char x;
+ unsigned char y;
for (;;) {
x = *s++ - 'A';
diff --git a/fmt_str.c b/fmt_str.c
@@ -2,7 +2,7 @@
unsigned int fmt_str(char *s, char *t)
{
- register unsigned int len;
+ unsigned int len;
char ch;
len = 0;
if (s) { while ((ch = t[len])) s[len++] = ch; }
diff --git a/fmt_strn.c b/fmt_strn.c
@@ -2,7 +2,7 @@
unsigned int fmt_strn(char *s, char *t, unsigned int n)
{
- register unsigned int len;
+ unsigned int len;
char ch;
len = 0;
if (s) { while (n-- && (ch = t[len])) s[len++] = ch; }
diff --git a/fmt_uint.c b/fmt_uint.c
@@ -2,5 +2,5 @@
unsigned int fmt_uint(char *s, unsigned int u)
{
- register unsigned long l; l = u; return fmt_ulong(s,l);
+ unsigned long l; l = u; return fmt_ulong(s,l);
}
diff --git a/fmt_ulong.c b/fmt_ulong.c
@@ -2,7 +2,7 @@
unsigned int fmt_ulong(char *s, unsigned long u)
{
- register unsigned int len; register unsigned long q;
+ unsigned int len; unsigned long q;
len = 1; q = u;
while (q > 9) { ++len; q /= 10; }
if (s) {
diff --git a/getln.c b/getln.c
@@ -5,8 +5,8 @@
#include "stralloc.h"
int getln(ss,sa,match,sep)
-register substdio *ss;
-register stralloc *sa;
+substdio *ss;
+stralloc *sa;
int *match;
int sep;
{
diff --git a/getln2.c b/getln2.c
@@ -4,14 +4,14 @@
#include "getln.h"
int getln2(ss,sa,cont,clen,sep)
-register substdio *ss;
-register stralloc *sa;
+substdio *ss;
+stralloc *sa;
/*@out@*/char **cont;
/*@out@*/unsigned int *clen;
int sep;
{
- register char *x;
- register unsigned int i;
+ char *x;
+ unsigned int i;
if (!stralloc_ready(sa,0)) return -1;
sa->len = 0;
diff --git a/scan_8long.c b/scan_8long.c
@@ -2,8 +2,8 @@
unsigned int scan_8long(char *s, unsigned long *u)
{
- register unsigned int pos; register unsigned long result;
- register unsigned long c;
+ unsigned int pos; unsigned long result;
+ unsigned long c;
pos = 0; result = 0;
while ((c = (unsigned long) (unsigned char) (s[pos] - '0')) < 8)
{ result = result * 8 + c; ++pos; }
diff --git a/scan_ulong.c b/scan_ulong.c
@@ -2,8 +2,8 @@
unsigned int scan_ulong(char *s, unsigned long *u)
{
- register unsigned int pos; register unsigned long result;
- register unsigned long c;
+ unsigned int pos; unsigned long result;
+ unsigned long c;
pos = 0; result = 0;
while ((c = (unsigned long) (unsigned char) (s[pos] - '0')) < 10)
{ result = result * 10 + c; ++pos; }
diff --git a/str_chr.c b/str_chr.c
@@ -1,11 +1,11 @@
#include "str.h"
unsigned int str_chr(s,c)
-register char *s;
+char *s;
int c;
{
- register char ch;
- register char *t;
+ char ch;
+ char *t;
ch = c;
t = s;
diff --git a/str_rchr.c b/str_rchr.c
@@ -1,12 +1,12 @@
#include "str.h"
unsigned int str_rchr(s,c)
-register char *s;
+char *s;
int c;
{
- register char ch;
- register char *t;
- register char *u;
+ char ch;
+ char *t;
+ char *u;
ch = c;
t = s;
diff --git a/str_start.c b/str_start.c
@@ -1,10 +1,10 @@
#include "str.h"
int str_start(s,t)
-register char *s;
-register char *t;
+char *s;
+char *t;
{
- register char x;
+ char x;
for (;;) {
x = *t++; if (!x) return 1; if (x != *s++) return 0;
diff --git a/substdi.c b/substdi.c
@@ -12,12 +12,12 @@ static ssize_t oneread(ssize_t (*op)(), int fd, char *buf, size_t len)
}
static int getthis(s,buf,len)
-register substdio *s;
-register char *buf;
-register int len;
+substdio *s;
+char *buf;
+int len;
{
- register int r;
- register int q;
+ int r;
+ int q;
r = s->p;
q = r - len;
@@ -30,7 +30,7 @@ register int len;
ssize_t substdio_feed(substdio *s)
{
ssize_t r;
- register int q;
+ int q;
if (s->p) return s->p;
q = s->n;
@@ -69,14 +69,14 @@ ssize_t substdio_get(substdio *s, char *buf, size_t len)
}
char *substdio_peek(s)
-register substdio *s;
+substdio *s;
{
return s->x + s->n;
}
void substdio_seek(s,len)
-register substdio *s;
-register int len;
+substdio *s;
+int len;
{
s->n += len;
s->p -= len;
diff --git a/substdio_copy.c b/substdio_copy.c
@@ -1,10 +1,10 @@
#include "substdio.h"
int substdio_copy(ssout,ssin)
-register substdio *ssout;
-register substdio *ssin;
+substdio *ssout;
+substdio *ssin;
{
- register char *x;
+ char *x;
for (;;) {
ssize_t n;
diff --git a/substdo.c b/substdo.c
@@ -21,9 +21,9 @@ static int allwrite(ssize_t (*op)(), int fd, char *buf, size_t len)
}
int substdio_flush(s)
-register substdio *s;
+substdio *s;
{
- register int p;
+ int p;
p = s->p;
if (!p) return 0;
@@ -33,7 +33,7 @@ register substdio *s;
int substdio_bput(substdio *s, char *buf, size_t len)
{
- register unsigned int n;
+ unsigned int n;
while (len > (n = s->n - s->p)) {
byte_copy(s->x + s->p,n,buf);
@@ -50,7 +50,7 @@ int substdio_bput(substdio *s, char *buf, size_t len)
int substdio_put(substdio *s, char *buf, size_t len)
{
- register unsigned int n = s->n; /* how many bytes to write in next chunk */
+ unsigned int n = s->n; /* how many bytes to write in next chunk */
/* check if the input would fit in the buffer without flushing */
if (len > n - (unsigned int)s->p) {
@@ -79,22 +79,22 @@ int substdio_putflush(substdio *s, char *buf, size_t len)
}
int substdio_bputs(s,buf)
-register substdio *s;
-register char *buf;
+substdio *s;
+char *buf;
{
return substdio_bput(s,buf,str_len(buf));
}
int substdio_puts(s,buf)
-register substdio *s;
-register char *buf;
+substdio *s;
+char *buf;
{
return substdio_put(s,buf,str_len(buf));
}
int substdio_putsflush(s,buf)
-register substdio *s;
-register char *buf;
+substdio *s;
+char *buf;
{
return substdio_putflush(s,buf,str_len(buf));
}