[PATCH] remove "register" storage class
Robert P. J. Day
rpjday at mindspring.com
Wed May 17 09:00:31 UTC 2006
i think this gets them all, except for what's happening in
shells/msh.c:
...
/* Conditional use of "register" keyword */
#define REGISTER register
...
followed by *numerous* uses of "REGISTER". what's up with that?
rday
-------------- next part --------------
diff -pru busybox/archival/gzip.c busybox.new/archival/gzip.c
--- busybox/archival/gzip.c 2006-05-11 08:04:11.000000000 -0400
+++ busybox.new/archival/gzip.c 2006-05-17 04:49:01.000000000 -0400
@@ -494,7 +494,7 @@ static void send_bits(int value, int len
*/
static unsigned bi_reverse(unsigned code, int len)
{
- register unsigned res = 0;
+ unsigned res = 0;
do {
res |= code & 1;
@@ -792,7 +792,7 @@ static void check_match(IPos start, IPos
*/
static void lm_init(ush * flags)
{
- register unsigned j;
+ unsigned j;
/* Initialize the hash table. */
memset(head, 0, HASH_SIZE * sizeof(*head));
@@ -842,9 +842,9 @@ static void lm_init(ush * flags)
static int longest_match(IPos cur_match)
{
unsigned chain_length = max_chain_length; /* max hash chain length */
- register uch *scan = window + strstart; /* current string */
- register uch *match; /* matched string */
- register int len; /* length of current match */
+ uch *scan = window + strstart; /* current string */
+ uch *match; /* matched string */
+ int len; /* length of current match */
int best_len = prev_length; /* best match length so far */
IPos limit =
strstart > (IPos) MAX_DIST ? strstart - (IPos) MAX_DIST : NIL;
@@ -858,9 +858,9 @@ static int longest_match(IPos cur_match)
#if HASH_BITS < 8 || MAX_MATCH != 258
# error Code too clever
#endif
- register uch *strend = window + strstart + MAX_MATCH;
- register uch scan_end1 = scan[best_len - 1];
- register uch scan_end = scan[best_len];
+ uch *strend = window + strstart + MAX_MATCH;
+ uch scan_end1 = scan[best_len - 1];
+ uch scan_end = scan[best_len];
/* Do not waste too much time if we already have a good match: */
if (prev_length >= good_match) {
@@ -947,7 +947,7 @@ static void check_match(IPos start, IPos
*/
static void fill_window(void)
{
- register unsigned n, m;
+ unsigned n, m;
unsigned more =
(unsigned) (window_size - (ulg) lookahead - (ulg) strstart);
/* Amount of free space at the end of the window. */
@@ -1015,7 +1015,7 @@ static ulg deflate(void)
IPos prev_match; /* previous match */
int flush; /* set if current block must be flushed */
int match_available = 0; /* set if previous match exists */
- register unsigned match_length = MIN_MATCH - 1; /* length of best match */
+ unsigned match_length = MIN_MATCH - 1; /* length of best match */
/* Process the input block. */
while (lookahead != 0) {
diff -pru busybox/archival/libunarchive/decompress_unzip.c busybox.new/archival/libunarchive/decompress_unzip.c
--- busybox/archival/libunarchive/decompress_unzip.c 2006-05-11 08:04:11.000000000 -0400
+++ busybox.new/archival/libunarchive/decompress_unzip.c 2006-05-17 04:48:29.000000000 -0400
@@ -214,16 +214,16 @@ int huft_build(unsigned int *b, const un
unsigned f; /* i repeats in table every f entries */
int g; /* maximum code length */
int h; /* table level */
- register unsigned i; /* counter, current code */
- register unsigned j; /* counter */
- register int k; /* number of bits in current code */
- register unsigned *p; /* pointer into c[], b[], or v[] */
- register huft_t *q; /* points to current table */
+ unsigned i; /* counter, current code */
+ unsigned j; /* counter */
+ int k; /* number of bits in current code */
+ unsigned *p; /* pointer into c[], b[], or v[] */
+ huft_t *q; /* points to current table */
huft_t r; /* table entry for structure assignment */
huft_t *u[BMAX]; /* table stack */
unsigned v[N_MAX]; /* values in order of bit length */
int ws[BMAX+1]; /* bits decoded stack */
- register int w; /* bits decoded */
+ int w; /* bits decoded */
unsigned x[BMAX + 1]; /* bit offsets, then code stack */
unsigned *xp; /* pointer into x */
int y; /* number of dummy codes added */
@@ -553,7 +553,7 @@ static int inflate_stored(int my_n, int
static int inflate_block(int *e)
{
unsigned t; /* block type */
- register unsigned int b; /* bit buffer */
+ unsigned int b; /* bit buffer */
unsigned int k; /* number of bits in bit buffer */
/* make local bit buffer */
diff -pru busybox/coreutils/od.c busybox.new/coreutils/od.c
--- busybox/coreutils/od.c 2006-05-11 08:04:16.000000000 -0400
+++ busybox.new/coreutils/od.c 2006-05-17 04:49:27.000000000 -0400
@@ -35,7 +35,7 @@
static void
odoffset(int argc, char ***argvp)
{
- register char *num, *p;
+ char *num, *p;
int base;
char *end;
diff -pru busybox/coreutils/test.c busybox.new/coreutils/test.c
--- busybox/coreutils/test.c 2006-05-11 08:04:16.000000000 -0400
+++ busybox.new/coreutils/test.c 2006-05-17 04:49:37.000000000 -0400
@@ -547,7 +547,7 @@ static void initialize_group_array(void)
/* Return non-zero if GID is one that we have in our groups list. */
static int is_a_group_member(gid_t gid)
{
- register int i;
+ int i;
/* Short-circuit if possible, maybe saving a call to getgroups(). */
if (gid == getgid() || gid == getegid())
diff -pru busybox/coreutils/tr.c busybox.new/coreutils/tr.c
--- busybox/coreutils/tr.c 2006-05-11 08:04:16.000000000 -0400
+++ busybox.new/coreutils/tr.c 2006-05-17 04:49:55.000000000 -0400
@@ -76,8 +76,8 @@ static void convert(void)
/* NOTREACHED */
}
-static void map(register unsigned char *string1, unsigned int string1_len,
- register unsigned char *string2, unsigned int string2_len)
+static void map(unsigned char *string1, unsigned int string1_len,
+ unsigned char *string2, unsigned int string2_len)
{
unsigned char last = '0';
unsigned int i, j;
@@ -95,7 +95,7 @@ static void map(register unsigned char *
* Escapes, e.g., \a ==> Control-G
* Character classes, e.g. [:upper:] ==> A ... Z
*/
-static unsigned int expand(const char *arg, register unsigned char *buffer)
+static unsigned int expand(const char *arg, unsigned char *buffer)
{
unsigned char *buffer_start = buffer;
int i, ac;
@@ -192,7 +192,7 @@ static unsigned int expand(const char *a
static int complement(unsigned char *buffer, int buffer_len)
{
- register short i, j, ix;
+ short i, j, ix;
char conv[ASCII + 2];
ix = 0;
@@ -209,7 +209,7 @@ static int complement(unsigned char *buf
int tr_main(int argc, char **argv)
{
- register unsigned char *ptr;
+ unsigned char *ptr;
int output_length=0, input_length;
int idx = 1;
int i;
diff -pru busybox/editors/awk.c busybox.new/editors/awk.c
--- busybox/editors/awk.c 2006-05-11 08:04:29.000000000 -0400
+++ busybox.new/editors/awk.c 2006-05-17 04:51:05.000000000 -0400
@@ -462,7 +462,7 @@ static void syntax_error(const char * co
static unsigned int hashidx(const char *name)
{
- register unsigned int idx=0;
+ unsigned int idx=0;
while (*name) idx = *name++ + (idx << 6) - idx;
return idx;
@@ -573,7 +573,7 @@ static void hash_remove(xhash *hash, con
static void skip_spaces(char **s)
{
- register char *p = *s;
+ char *p = *s;
while(*p == ' ' || *p == '\t' ||
(*p == '\\' && *(p+1) == '\n' && (++p, ++t.lineno))) {
@@ -584,7 +584,7 @@ static void skip_spaces(char **s)
static char *nextword(char **s)
{
- register char *p = *s;
+ char *p = *s;
while (*(*s)++) ;
@@ -593,7 +593,7 @@ static char *nextword(char **s)
static char nextchar(char **s)
{
- register char c, *pps;
+ char c, *pps;
c = *((*s)++);
pps = *s;
@@ -685,7 +685,7 @@ static var *setvar_u(var *v, const char
/* set array element to user string */
static void setari_u(var *a, int idx, const char *s)
{
- register var *v;
+ var *v;
static char sidx[12];
sprintf(sidx, "%d", idx);
@@ -990,7 +990,7 @@ static void rollback_token(void) { t.rol
static node *new_node(uint32_t info)
{
- register node *n;
+ node *n;
n = (node *)xcalloc(sizeof(node), 1);
n->info = info;
@@ -1135,7 +1135,7 @@ static node *parse_expr(uint32_t iexp)
/* add node to chain. Return ptr to alloc'd node */
static node *chain_node(uint32_t info)
{
- register node *n;
+ node *n;
if (! seq->first)
seq->first = seq->last = new_node(0);
@@ -1354,7 +1354,7 @@ static void parse_program(char *p)
static node *mk_splitter(char *s, tsplitter *spl)
{
- register regex_t *re, *ire;
+ regex_t *re, *ire;
node *n;
re = &spl->re[0];
diff -pru busybox/libbb/bb_echo.c busybox.new/libbb/bb_echo.c
--- busybox/libbb/bb_echo.c 2006-05-11 08:04:19.000000000 -0400
+++ busybox.new/libbb/bb_echo.c 2006-05-17 04:52:02.000000000 -0400
@@ -70,7 +70,7 @@ int bb_echo(int ATTRIBUTE_UNUSED argc, c
just_echo:
#endif
while (*argv) {
- register int c;
+ int c;
while ((c = *(*argv)++)) {
if (c == eflag) { /* Check for escape seq. */
diff -pru busybox/libbb/dump.c busybox.new/libbb/dump.c
--- busybox/libbb/dump.c 2006-05-11 08:04:19.000000000 -0400
+++ busybox.new/libbb/dump.c 2006-05-17 04:51:48.000000000 -0400
@@ -38,9 +38,9 @@ static const char lcc[] = "diouxX";
int bb_dump_size(FS * fs)
{
- register FU *fu;
- register int bcnt, cur_size;
- register char *fmt;
+ FU *fu;
+ int bcnt, cur_size;
+ char *fmt;
const char *p;
int prec;
@@ -83,9 +83,9 @@ int bb_dump_size(FS * fs)
static void rewrite(FS * fs)
{
enum { NOTOKAY, USEBCNT, USEPREC } sokay;
- register PR *pr, **nextpr = NULL;
- register FU *fu;
- register char *p1, *p2, *p3;
+ PR *pr, **nextpr = NULL;
+ FU *fu;
+ char *p1, *p2, *p3;
char savech, *fmtp;
const char *byte_count_str;
int nconv, prec = 0;
@@ -356,7 +356,7 @@ static unsigned char *get(void)
{
static int ateof = 1;
static unsigned char *curp=NULL, *savp; /*DBU:[dave at cray.com]initialize curp */
- register int n;
+ int n;
int need, nread;
unsigned char *tmpp;
@@ -426,7 +426,7 @@ static unsigned char *get(void)
static void bpad(PR * pr)
{
- register char *p1, *p2;
+ char *p1, *p2;
/*
* remove all conversion flags; '-' is the only one valid
@@ -503,11 +503,11 @@ static void conv_u(PR * pr, unsigned cha
static void display(void)
{
/* extern FU *endfu; */
- register FS *fs;
- register FU *fu;
- register PR *pr;
- register int cnt;
- register unsigned char *bp;
+ FS *fs;
+ FU *fu;
+ PR *pr;
+ int cnt;
+ unsigned char *bp;
off_t saveaddress;
unsigned char savech = 0, *savebp;
@@ -651,7 +651,7 @@ static void display(void)
int bb_dump_dump(char **argv)
{
- register FS *tfs;
+ FS *tfs;
/* figure out the data block bb_dump_size */
for (bb_dump_blocksize = 0, tfs = bb_dump_fshead; tfs; tfs = tfs->nextfs) {
@@ -673,9 +673,9 @@ int bb_dump_dump(char **argv)
void bb_dump_add(const char *fmt)
{
- register const char *p;
- register char *p1;
- register char *p2;
+ const char *p;
+ char *p1;
+ char *p2;
static FS **nextfs;
FS *tfs;
FU *tfu, **nextfu;
diff -pru busybox/loginutils/login.c busybox.new/loginutils/login.c
--- busybox/loginutils/login.c 2006-05-11 08:04:24.000000000 -0400
+++ busybox.new/loginutils/login.c 2006-05-17 04:52:19.000000000 -0400
@@ -378,7 +378,7 @@ static int is_my_tty ( const char *tty )
static void motd (void)
{
FILE *fp;
- register int c;
+ int c;
if (( fp = fopen ( bb_path_motd_file, "r" ))) {
while (( c = getc ( fp )) != EOF )
diff -pru busybox/networking/udhcp/packet.c busybox.new/networking/udhcp/packet.c
--- busybox/networking/udhcp/packet.c 2006-05-11 08:04:07.000000000 -0400
+++ busybox.new/networking/udhcp/packet.c 2006-05-17 04:56:14.000000000 -0400
@@ -87,7 +87,7 @@ uint16_t checksum(void *addr, int count)
/* Compute Internet Checksum for "count" bytes
* beginning at location "addr".
*/
- register int32_t sum = 0;
+ int32_t sum = 0;
uint16_t *source = (uint16_t *) addr;
while (count > 1) {
diff -pru busybox/shell/ash.c busybox.new/shell/ash.c
--- busybox/shell/ash.c 2006-05-12 17:48:03.000000000 -0400
+++ busybox.new/shell/ash.c 2006-05-17 04:54:59.000000000 -0400
@@ -13452,7 +13452,7 @@ static const char op_tokens[] = {
static arith_t arith (const char *expr, int *perrcode)
{
- register char arithval; /* Current character under analysis */
+ char arithval; /* Current character under analysis */
operator lasttok, op;
operator prec;
diff -pru busybox/shell/lash.c busybox.new/shell/lash.c
--- busybox/shell/lash.c 2006-05-11 08:04:13.000000000 -0400
+++ busybox.new/shell/lash.c 2006-05-17 04:55:17.000000000 -0400
@@ -747,10 +747,10 @@ static int get_command(FILE * source, ch
return 0;
}
-static char* itoa(register int i)
+static char* itoa(int i)
{
static char a[7]; /* Max 7 ints */
- register char *b = a + sizeof(a) - 1;
+ char *b = a + sizeof(a) - 1;
int sign = (i < 0);
if (sign)
More information about the busybox
mailing list