[PATCH] remove all "register" storage class specifiers

Robert P. J. Day rpjday at mindspring.com
Mon Mar 27 11:12:00 UTC 2006


  (ok, all except for those under the "scripts" directory as those can
be processed separately.  the subsequent build makes no difference
whatsoever in the output of "make sizes".)

diff -pru busybox.orig/archival/gzip.c busybox/archival/gzip.c
--- busybox.orig/archival/gzip.c	2006-03-25 17:07:01.000000000 -0500
+++ busybox/archival/gzip.c	2006-03-27 05:59:47.000000000 -0500
@@ -347,7 +347,7 @@ static void write_buf(int fd, void *buf,
 static ulg updcrc(uch * s, unsigned n)
 {
 	static ulg crc = (ulg) 0xffffffffL;	/* shift register contents */
-	register ulg c;		/* temporary variable */
+	ulg c;		/* temporary variable */
 	static unsigned long crc_32_tab[256];

 	if (crc_32_tab[1] == 0x00000000L) {
@@ -512,7 +512,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;
@@ -810,7 +810,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));
@@ -860,9 +860,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;
@@ -876,9 +876,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) {
@@ -965,7 +965,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. */
@@ -1033,7 +1033,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.orig/archival/libunarchive/decompress_unzip.c busybox/archival/libunarchive/decompress_unzip.c
--- busybox.orig/archival/libunarchive/decompress_unzip.c	2006-03-25 17:07:01.000000000 -0500
+++ busybox/archival/libunarchive/decompress_unzip.c	2006-03-27 05:59:05.000000000 -0500
@@ -242,16 +242,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 */
@@ -581,7 +581,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.orig/coreutils/od.c busybox/coreutils/od.c
--- busybox.orig/coreutils/od.c	2006-03-25 17:07:06.000000000 -0500
+++ busybox/coreutils/od.c	2006-03-27 06:00:10.000000000 -0500
@@ -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.orig/coreutils/test.c busybox/coreutils/test.c
--- busybox.orig/coreutils/test.c	2006-03-25 17:07:06.000000000 -0500
+++ busybox/coreutils/test.c	2006-03-27 06:00:44.000000000 -0500
@@ -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.orig/coreutils/tr.c busybox/coreutils/tr.c
--- busybox.orig/coreutils/tr.c	2006-03-25 17:07:06.000000000 -0500
+++ busybox/coreutils/tr.c	2006-03-27 06:00:28.000000000 -0500
@@ -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;
@@ -187,7 +187,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;
@@ -204,7 +204,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.orig/editors/awk.c busybox/editors/awk.c
--- busybox.orig/editors/awk.c	2006-03-25 17:07:19.000000000 -0500
+++ busybox/editors/awk.c	2006-03-27 06:01:57.000000000 -0500
@@ -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.orig/libbb/bb_echo.c busybox/libbb/bb_echo.c
--- busybox.orig/libbb/bb_echo.c	2006-03-25 17:07:09.000000000 -0500
+++ busybox/libbb/bb_echo.c	2006-03-27 06:02:28.000000000 -0500
@@ -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.orig/libbb/dump.c busybox/libbb/dump.c
--- busybox.orig/libbb/dump.c	2006-03-25 17:07:09.000000000 -0500
+++ busybox/libbb/dump.c	2006-03-27 06:03:00.000000000 -0500
@@ -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.orig/loginutils/login.c busybox/loginutils/login.c
--- busybox.orig/loginutils/login.c	2006-03-25 17:07:16.000000000 -0500
+++ busybox/loginutils/login.c	2006-03-27 06:03:22.000000000 -0500
@@ -382,7 +382,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.orig/networking/udhcp/packet.c busybox/networking/udhcp/packet.c
--- busybox.orig/networking/udhcp/packet.c	2006-03-25 17:07:25.000000000 -0500
+++ busybox/networking/udhcp/packet.c	2006-03-27 06:04:57.000000000 -0500
@@ -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.orig/shell/ash.c busybox/shell/ash.c
--- busybox.orig/shell/ash.c	2006-03-25 17:07:04.000000000 -0500
+++ busybox/shell/ash.c	2006-03-27 06:06:03.000000000 -0500
@@ -13451,7 +13451,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.orig/shell/lash.c busybox/shell/lash.c
--- busybox.orig/shell/lash.c	2006-03-25 17:07:04.000000000 -0500
+++ busybox/shell/lash.c	2006-03-27 06:06:13.000000000 -0500
@@ -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)
diff -pru busybox.orig/util-linux/hexdump.c busybox/util-linux/hexdump.c
--- busybox.orig/util-linux/hexdump.c	2006-03-25 17:07:21.000000000 -0500
+++ busybox/util-linux/hexdump.c	2006-03-27 06:06:29.000000000 -0500
@@ -30,7 +30,7 @@

 static void bb_dump_addfile(char *name)
 {
-	register char *p;
+	char *p;
 	FILE *fp;
 	char *buf;

@@ -68,7 +68,6 @@ static const struct suffix_mult suffixes

 int hexdump_main(int argc, char **argv)
 {
-//	register FS *tfs;
 	const char *p;
 	int ch;


Signed off by:  Robert P. J. Day <rpjday at mindspring.com>



More information about the busybox mailing list