NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/53237: ksh: remove register keyword



>Number:         53237
>Category:       bin
>Synopsis:       ksh: remove register keyword
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 30 14:25:00 +0000 2018
>Originator:     nia
>Release:        current
>Organization:
>Environment:
>Description:
`register` is ignored by modern compilers

ksh also does some strange things with it, like put it in argument lists
>How-To-Repeat:

>Fix:
Index: c_ksh.c
===================================================================
RCS file: /cvsroot/src/bin/ksh/c_ksh.c,v
retrieving revision 1.27
diff -u -r1.27 c_ksh.c
--- c_ksh.c	24 Jan 2018 09:53:20 -0000	1.27
+++ c_ksh.c	30 Apr 2018 14:13:06 -0000
@@ -317,7 +317,7 @@
 	Xinit(xs, xp, 128, ATEMP);
 
 	while (*wp != NULL) {
-		register int c;
+		int c;
 		s = *wp;
 		while ((c = *s++) != '\0') {
 			Xcheck(xs, xp);
@@ -995,8 +995,8 @@
 c_unalias(wp)
 	char **wp;
 {
-	register struct table *t = &aliases;
-	register struct tbl *ap;
+	struct table *t = &aliases;
+	struct tbl *ap;
 	int rv = 0, all = 0;
 	int optc;
 
@@ -1389,7 +1389,7 @@
 	char **wp;
 {
 	int rv = 0, macro = 0, list = 0;
-	register char *cp;
+	char *cp;
 	int optc;
 
 	while ((optc = ksh_getopt(wp, &builtin_opt, "lm")) != EOF)
Index: c_sh.c
===================================================================
RCS file: /cvsroot/src/bin/ksh/c_sh.c,v
retrieving revision 1.23
diff -u -r1.23 c_sh.c
--- c_sh.c	30 Jun 2017 04:41:19 -0000	1.23
+++ c_sh.c	30 Apr 2018 14:13:06 -0000
@@ -31,8 +31,8 @@
 c_shift(wp)
 	char **wp;
 {
-	register struct block *l = e->loc;
-	register int n;
+	struct block *l = e->loc;
+	int n;
 	long val;
 	char *arg;
 
@@ -63,8 +63,8 @@
 c_umask(wp)
 	char **wp;
 {
-	register int i;
-	register char *cp;
+	int i;
+	char *cp;
 	int symbolic = 0;
 	int old_umask;
 	int optc;
@@ -245,11 +245,11 @@
 c_read(wp)
 	char **wp;
 {
-	register int c = 0;
+	int c = 0;
 	int expandv = 1, history = 0;
 	int expanding;
 	int ecode = 0;
-	register char *cp;
+	char *cp;
 	int fd = 0;
 	struct shf *shf;
 	int optc;
@@ -429,7 +429,7 @@
 c_eval(wp)
 	char **wp;
 {
-	register struct source *s;
+	struct source *s;
 	int rv;
 
 	if (ksh_getopt(wp, &builtin_opt, null) == '?')
@@ -475,7 +475,7 @@
 {
 	int i;
 	char *s;
-	register Trap *p;
+	Trap *p;
 
 	if (ksh_getopt(wp, &builtin_opt, null) == '?')
 		return 1;
@@ -635,7 +635,7 @@
 {
 	int argi, setargs;
 	struct block *l = e->loc;
-	register char **owp = wp;
+	char **owp = wp;
 
 	if (wp[1] == NULL) {
 		static const char *const args [] = { "set", "-", NULL };
@@ -669,7 +669,7 @@
 c_unset(wp)
 	char **wp;
 {
-	register char *id;
+	char *id;
 	int optc, unset_var = 1;
 	int ret = 0;
 
@@ -816,8 +816,8 @@
 	clock_t t;
 {
 	static char temp[22]; /* enough for 64 bit clock_t */
-	register int i;
-	register char *cp = temp + sizeof(temp);
+	int i;
+	char *cp = temp + sizeof(temp);
 
 	/* note: posix says must use max precision, ie, if clk_tck is
 	 * 1000, must print 3 places after decimal (if non-zero, else 1).
Index: emacs.c
===================================================================
RCS file: /cvsroot/src/bin/ksh/emacs.c,v
retrieving revision 1.37
diff -u -r1.37 emacs.c
--- emacs.c	30 Jun 2017 04:41:19 -0000	1.37
+++ emacs.c	30 Apr 2018 14:13:06 -0000
@@ -454,7 +454,7 @@
 	char	*s;
 {
 	char *cp = xcp;
-	register int	adj = x_adj_done;
+	int	adj = x_adj_done;
 
 	if (x_do_ins(s, strlen(s)) < 0)
 		return -1;
@@ -619,7 +619,7 @@
 x_bword()
 {
 	int	nc = 0;
-	register char *cp = xcp;
+	char *cp = xcp;
 
 	if (cp == xbuf)  {
 		x_e_putc(BEL);
@@ -646,7 +646,7 @@
 x_fword()
 {
 	int	nc = 0;
-	register char	*cp = xcp;
+	char	*cp = xcp;
 
 	if (cp == xep)  {
 		x_e_putc(BEL);
@@ -670,7 +670,7 @@
 
 static void
 x_goto(cp)
-	register char *cp;
+	char *cp;
 {
   if (cp < xbp || cp >= (xbp + x_displen))
   {
@@ -700,7 +700,7 @@
 x_bs(c)
 	int c;
 {
-	register int i;
+	int i;
 	i = x_size(c);
 	while (i--)
 		x_e_putc('\b');
@@ -708,9 +708,9 @@
 
 static int
 x_size_str(cp)
-	register char *cp;
+	char *cp;
 {
-	register int size = 0;
+	int size = 0;
 	while (*cp)
 		size += x_size(*cp++);
 	return size;
@@ -729,9 +729,9 @@
 
 static void
 x_zots(str)
-	register char *str;
+	char *str;
 {
-  register int	adj = x_adj_done;
+  int	adj = x_adj_done;
 
   x_lastcp();
   while (*str && str < xlp && adj == x_adj_done)
@@ -870,7 +870,7 @@
 
 static void
 x_load_hist(hp)
-	register char **hp;
+	char **hp;
 {
 	int	oldsize;
 
@@ -915,7 +915,7 @@
 {
 	int offset = -1;	/* offset of match in xbuf, else -1 */
 	char pat [256+1];	/* pattern buffer */
-	register char *p = pat;
+	char *p = pat;
 	Findex f;
 
 	*p = '\0';
@@ -978,7 +978,7 @@
 	int sameline;
 	int offset;
 {
-	register char **hp;
+	char **hp;
 	int i;
 
 	for (hp = x_histp - (sameline ? 0 : 1) ; hp >= histlist; --hp) {
@@ -1349,7 +1349,7 @@
 	int c;
 {
 	static char buf[8];
-	register char *p = buf;
+	char *p = buf;
 
 	if (iscntrl((unsigned char)c))  {
 		*p++ = '^';
@@ -1473,7 +1473,7 @@
 x_init_emacs()
 {
 	size_t i;
-	register int j;
+	int j;
 	char *locale;
 
 	ainit(AEDIT);
@@ -1627,7 +1627,7 @@
 	int c;
 {
 	char	newbuf [256+1];
-	register char *ip, *op;
+	char	*ip, *op;
 	int	i, len;
 
 	i = xep - xbuf;
@@ -1926,7 +1926,7 @@
 x_e_puts(s)
 	const char *s;
 {
-  register int	adj = x_adj_done;
+  int	adj = x_adj_done;
 
   while (*s && adj == x_adj_done)
     x_e_putc(*s++);
@@ -2007,7 +2007,7 @@
 x_prev_histword(c)
 	int c;
 {
-  register char *rcp;
+  char *rcp;
   char *cp;
 
   cp = *histptr;
@@ -2158,8 +2158,8 @@
 static char *
 x_lastcp()
 {
-  register char *rcp;
-  register int i;
+  char *rcp;
+  int i;
 
   if (!xlp_valid)
   {
Index: eval.c
===================================================================
RCS file: /cvsroot/src/bin/ksh/eval.c,v
retrieving revision 1.22
diff -u -r1.22 eval.c
--- eval.c	30 Jun 2017 04:41:19 -0000	1.22
+++ eval.c	30 Apr 2018 14:13:06 -0000
@@ -86,7 +86,7 @@
  */
 char **
 eval(ap, f)
-	register char **ap;
+	char **ap;
 	int f;
 {
 	XPtrV w;
@@ -124,7 +124,7 @@
  */
 char *
 evalonestr(cp, f)
-	register char *cp;
+	char *cp;
 	int f;
 {
 	XPtrV w;
@@ -160,14 +160,14 @@
 void
 expand(cp, wp, f)
 	char *cp;		/* input word */
-	register XPtrV *wp;	/* output words */
+	XPtrV *wp;		/* output words */
 	int f;			/* DO* flags */
 {
-	register int UNINITIALIZED(c);
-	register int type;	/* expansion type */
-	register int quote = 0;	/* quoted */
+	int UNINITIALIZED(c);
+	int type;		/* expansion type */
+	int quote = 0;		/* quoted */
 	XString ds;		/* destination string */
-	register char *dp, *sp;	/* dest., source */
+	char *dp, *sp;		/* dest., source */
 	int fdo, word;		/* second pass flags; have word */
 	int doblank;		/* field splitting of parameter/command subst */
 	Expand x;		/* expansion variables */
@@ -844,11 +844,11 @@
  */
 static int
 comsub(xp, cp)
-	register Expand *xp;
+	Expand *xp;
 	char *cp;
 {
 	Source *s, *sold;
-	register struct op *t;
+	struct op *t;
 	struct shf *shf;
 
 	s = pushs(SSTRING, ATEMP);
@@ -863,7 +863,7 @@
 
 	if (t != NULL && t->type == TCOM && /* $(<file) */
 	    *t->args == NULL && *t->vars == NULL && t->ioact != NULL) {
-		register struct ioword *io = *t->ioact;
+		struct ioword *io = *t->ioact;
 		char *name;
 
 		if ((io->flag&IOTYPE) != IOREAD)
@@ -899,12 +899,12 @@
 
 static char *
 trimsub(str, pat, how)
-	register char *str;
+	char *str;
 	char *pat;
 	int how;
 {
-	register char *end = strchr(str, 0);
-	register char *p, c;
+	char *end = strchr(str, 0);
+	char *p, c;
 
 	switch (how&0xff) {	/* UCHAR_MAX maybe? */
 	  case '#':		/* shortest at beginning */
@@ -953,7 +953,7 @@
 static void
 glob(cp, wp, markdirs)
 	char *cp;
-	register XPtrV *wp;
+	XPtrV *wp;
 	int markdirs;
 {
 	int oldsize = XPsize(*wp);
@@ -995,10 +995,10 @@
 	XString *xs;		/* dest string */
 	char **xpp;		/* ptr to dest end */
 	char *sp;		/* source path */
-	register XPtrV *wp;	/* output list */
+	XPtrV *wp;		/* output list */
 	int check;		/* GF_* flags */
 {
-	register char *np;	/* next source component */
+	char *np;		/* next source component */
 	char *xp = *xpp;
 	char *se;
 	char odirsep;
@@ -1277,7 +1277,7 @@
 homedir(name)
 	char *name;
 {
-	register struct tbl *ap;
+	struct tbl *ap;
 
 	ap = tenter(&homedirs, name, hash(name));
 	if (!(ap->flag & ISSET)) {
Index: exec.c
===================================================================
RCS file: /cvsroot/src/bin/ksh/exec.c,v
retrieving revision 1.26
diff -u -r1.26 exec.c
--- exec.c	24 Jan 2018 09:53:21 -0000	1.26
+++ exec.c	30 Apr 2018 14:13:06 -0000
@@ -445,14 +445,14 @@
 comexec(t, tp, ap, flags)
 	struct op *t;
 	struct tbl *volatile tp;
-	register char **ap;
+	char **ap;
 	int volatile flags;
 {
 	int i;
 	int leave = LLEAVE;
 	volatile int rv = 0;
-	register char *cp;
-	register char **lastp;
+	char *cp;
+	char **lastp;
 	static struct op texec; /* Must be static (XXX but why?) */
 	int type_flags;
 	int keepasn_ok;
@@ -749,8 +749,8 @@
 
 static void
 scriptexec(tp, ap)
-	register struct op *tp;
-	register char **ap;
+	struct op *tp;
+	char **ap;
 {
 	char *shellv;
 
@@ -771,9 +771,9 @@
 
 int
 shcomexec(wp)
-	register char **wp;
+	char **wp;
 {
-	register struct tbl *tp;
+	struct tbl *tp;
 
 	tp = mytsearch(&builtins, *wp, hash(*wp));
 	if (tp == NULL)
@@ -863,7 +863,7 @@
 	const char *name;
 	int (*func) ARGS((char **));
 {
-	register struct tbl *tp;
+	struct tbl *tp;
 	Tflag flag;
 
 	/* see if any flags should be set for this builtin */
@@ -1112,10 +1112,10 @@
  */
 static int
 iosetup(iop, tp)
-	register struct ioword *iop;
+	struct ioword *iop;
 	struct tbl *tp;
 {
-	register int u = -1;
+	int u = -1;
 	char *cp = iop->name;
 	int iotype = iop->flag & IOTYPE;
 	int do_open = 1, do_close = 0, UNINITIALIZED(flags);
Index: expand.h
===================================================================
RCS file: /cvsroot/src/bin/ksh/expand.h,v
retrieving revision 1.6
diff -u -r1.6 expand.h
--- expand.h	30 Jun 2017 05:14:12 -0000	1.6
+++ expand.h	30 Apr 2018 14:13:06 -0000
@@ -65,7 +65,7 @@
 } XPtrV;
 
 #define	XPinit(x, n) do { \
-			register void **vp__; \
+			void **vp__; \
 			vp__ = (void**) alloc(sizeofN(void*, n), ATEMP); \
 			(x).cur = (x).beg = vp__; \
 			(x).end = vp__ + n; \
Index: expr.c
===================================================================
RCS file: /cvsroot/src/bin/ksh/expr.c,v
retrieving revision 1.11
diff -u -r1.11 expr.c
--- expr.c	1 Jul 2017 23:12:08 -0000	1.11
+++ expr.c	30 Apr 2018 14:13:06 -0000
@@ -570,7 +570,7 @@
 static struct tbl *
 tempvar()
 {
-	register struct tbl *vp;
+	struct tbl *vp;
 
 	vp = (struct tbl*) alloc(sizeof(struct tbl), ATEMP);
 	vp->flag = ISSET|INTEGER;
Index: history.c
===================================================================
RCS file: /cvsroot/src/bin/ksh/history.c,v
retrieving revision 1.18
diff -u -r1.18 history.c
--- history.c	17 Jan 2018 00:29:22 -0000	1.18
+++ history.c	30 Apr 2018 14:13:06 -0000
@@ -617,7 +617,7 @@
 	const char *cmd;
 	int dowrite;	/* ignored (compatibility with COMPLEX_HISTORY) */
 {
-	register char **hp = histptr;
+	char **hp = histptr;
 	char *cp;
 
 	if (++hp >= histlist + histsize) { /* remove oldest command */
@@ -738,8 +738,8 @@
   static int once;
   int fd;
   FILE *fh;
-  register int i;
-  register char **hp;
+  int i;
+  char **hp;
 
   if (once++)
     return;
@@ -784,7 +784,7 @@
 	const char *cmd;
 	int dowrite;
 {
-	register char **hp;
+	char **hp;
 	char *c, *cp;
 
 	c = str_save(cmd, APERM);
@@ -909,8 +909,8 @@
 
 static int
 hist_count_lines(base, bytes)
-	register unsigned char *base;
-	register int bytes;
+	unsigned char *base;
+	int bytes;
 {
 	State state = shdr;
 	int lines = 0;
@@ -1002,8 +1002,8 @@
 	int *bytes;
 	int no;
 {
-	register int lines = 0;
-	register unsigned char *ep;
+	int lines = 0;
+	unsigned char *ep;
 
 	for (ep = base + *bytes; --ep > base; ) {
 		/* this doesn't really work: the 4 byte line number that is
@@ -1028,8 +1028,8 @@
 static void
 histload(s, base, bytes)
 	Source *s;
-	register unsigned char *base;
-	register int bytes;
+	unsigned char *base;
+	int bytes;
 {
 	State state;
 	int	lno = 0;
@@ -1084,7 +1084,7 @@
 	int lno;
 	unsigned char *line;
 {
-	register char **hp;
+	char **hp;
 
 	if (lno >= s->line-(histptr-histlist) && lno <= s->line) {
 		hp = &histptr[lno-s->line];
Index: io.c
===================================================================
RCS file: /cvsroot/src/bin/ksh/io.c,v
retrieving revision 1.17
diff -u -r1.17 io.c
--- io.c	30 Jun 2017 04:41:19 -0000	1.17
+++ io.c	30 Apr 2018 14:13:06 -0000
@@ -284,7 +284,7 @@
 
 void
 openpipe(pv)
-	register int *pv;
+	int *pv;
 {
 	if (pipe(pv) < 0)
 		errorf("can't create pipe - try again");
@@ -294,7 +294,7 @@
 
 void
 closepipe(pv)
-	register int *pv;
+	int *pv;
 {
 	close(pv[0]);
 	close(pv[1]);
Index: lex.c
===================================================================
RCS file: /cvsroot/src/bin/ksh/lex.c,v
retrieving revision 1.22
diff -u -r1.22 lex.c
--- lex.c	24 Jan 2018 09:53:21 -0000	1.22
+++ lex.c	30 Apr 2018 14:13:07 -0000
@@ -108,9 +108,9 @@
 {
 	Lex_state states[STATE_BSIZE], *statep;
 	State_info state_info;
-	register int c, state;
+	int c, state;
 	XString ws;		/* expandable output word */
-	register char *wp;	/* output word pointer */
+	char *wp;		/* output word pointer */
 	char *sp, *dp;
 	int c2;
 
@@ -743,7 +743,7 @@
 		if ((cf & ALIAS) && (p = mytsearch(&aliases, ident, h))
 		    && (p->flag & ISSET))
 		{
-			register Source *s;
+			Source *s;
 
 			for (s = source; s->type == SALIAS; s = s->next)
 				if (s->u.tblp == p)
@@ -765,7 +765,7 @@
 static void
 gethere()
 {
-	register struct ioword **p;
+	struct ioword **p;
 
 	for (p = heres; p < herep; p++)
 		readhere(*p);
@@ -780,7 +780,7 @@
 readhere(iop)
 	struct ioword *iop;
 {
-	register int c;
+	int c;
 	char *volatile eof;
 	char *eofp;
 	int skiptabs;
@@ -861,7 +861,7 @@
 	int type;
 	Area *areap;
 {
-	register Source *s;
+	Source *s;
 
 	s = (Source *) alloc(sizeof(Source), areap);
 	s->type = type;
@@ -884,8 +884,8 @@
 static int
 getsc__()
 {
-	register Source *s = source;
-	register int c;
+	Source *s = source;
+	int c;
 
 	while ((c = *s->str++) == 0) {
 		s->str = NULL;		/* return 0 for EOF by default */
Index: mail.c
===================================================================
RCS file: /cvsroot/src/bin/ksh/mail.c,v
retrieving revision 1.8
diff -u -r1.8 mail.c
--- mail.c	30 Jun 2017 04:41:19 -0000	1.8
+++ mail.c	30 Apr 2018 14:13:07 -0000
@@ -46,7 +46,7 @@
 void
 mcheck()
 {
-	register mbox_t	*mbp;
+	mbox_t	*mbp;
 	time_t		 now;
 	struct tbl	*vp;
 	struct stat	 stbuf;
@@ -96,7 +96,7 @@
 
 void
 mbset(p)
-	register char	*p;
+	char	*p;
 {
 	struct stat	stbuf;
 
@@ -115,10 +115,10 @@
 
 void
 mpset(mptoparse)
-	register char	*mptoparse;
+	char	*mptoparse;
 {
-	register mbox_t	*mbp;
-	register char	*mpath, *mmsg, *mval;
+	mbox_t	*mbp;
+	char	*mpath, *mmsg, *mval;
 	char *p;
 
 	munset( mplist );
@@ -155,9 +155,9 @@
 
 static void
 munset(mlist)
-register mbox_t	*mlist;
+mbox_t	*mlist;
 {
-	register mbox_t	*mbp;
+	mbox_t	*mbp;
 
 	while (mlist != NULL) {
 		mbp = mlist;
@@ -174,7 +174,7 @@
 	char	*m;
 {
 	struct stat	stbuf;
-	register mbox_t	*mbp;
+	mbox_t	*mbp;
 
 	mbp = (mbox_t *)alloc(sizeof(mbox_t), APERM);
 	mbp->mb_next = NULL;
Index: main.c
===================================================================
RCS file: /cvsroot/src/bin/ksh/main.c,v
retrieving revision 1.22
diff -u -r1.22 main.c
--- main.c	30 Jun 2017 04:41:19 -0000	1.22
+++ main.c	30 Apr 2018 14:13:07 -0000
@@ -93,7 +93,7 @@
 int
 main(int argc, char *argv[])
 {
-	register int i;
+	int i;
 	int argi;
 	Source *s;
 	struct block *l;
@@ -421,7 +421,7 @@
 	char **argv;
 	int intr_ok;
 {
-	register Source *volatile s = NULL;
+	Source *volatile s = NULL;
 	struct shf *shf;
 	char **volatile old_argv;
 	volatile int old_argc;
@@ -490,7 +490,7 @@
 command(comm)
 	const char *comm;
 {
-	register Source *s;
+	Source *s;
 	int r;
 
 	s = pushs(SSTRING, ATEMP);
@@ -653,7 +653,7 @@
 newenv(type)
 	int type;
 {
-	register struct env *ep;
+	struct env *ep;
 
 	ep = (struct env *) alloc(sizeof(*ep), ATEMP);
 	ep->type = type;
@@ -669,8 +669,8 @@
 void
 quitenv()
 {
-	register struct env *ep = e;
-	register int fd;
+	struct env *ep = e;
+	int fd;
 
 	if (ep->oenv && ep->oenv->loc != ep->loc)
 		popblock();
Index: misc.c
===================================================================
RCS file: /cvsroot/src/bin/ksh/misc.c,v
retrieving revision 1.23
diff -u -r1.23 misc.c
--- misc.c	30 Jun 2017 04:41:19 -0000	1.23
+++ misc.c	30 Apr 2018 14:13:07 -0000
@@ -30,10 +30,10 @@
  */
 void
 setctypes(s, t)
-	register const char *s;
-	register int t;
+	const char *s;
+	int t;
 {
-	register int i;
+	int i;
 
 	if (t & C_IFS) {
 		for (i = 0; i < UCHAR_MAX+1; i++)
@@ -47,7 +47,7 @@
 void
 initctypes()
 {
-	register int c;
+	int c;
 
 	for (c = 'a'; c <= 'z'; c++)
 		ctypes[c] |= C_ALPHA;
@@ -67,10 +67,10 @@
 
 char *
 ulton(n, base)
-	register unsigned long n;
+	unsigned long n;
 	int base;
 {
-	register char *p;
+	char *p;
 	static char buf [20];
 
 	p = &buf[sizeof(buf)];
@@ -84,7 +84,7 @@
 
 char *
 str_save(s, ap)
-	register const char *s;
+	const char *s;
 	Area *ap;
 {
 	size_t len;
@@ -104,7 +104,7 @@
  */
 char *
 str_nsave(s, n, ap)
-	register const char *s;
+	const char *s;
 	int n;
 	Area *ap;
 {
@@ -272,7 +272,7 @@
 {
 	size_t i;
 	char m[(int) FNFLAGS + 1];
-	register char *cp = m;
+	char *cp = m;
 
 	for (i = 0; i < NELEM(goptions); i++)
 		if (goptions[i].c && Flag(i))
@@ -766,9 +766,9 @@
 static const unsigned char *
 cclass(p, sub)
 	const unsigned char *p;
-	register int sub;
+	int sub;
 {
-	register int c, d, not, found = 0;
+	int c, d, not, found = 0;
 	const unsigned char *orig_p = p;
 
 	if ((not = (ISMAGIC(*p) && *++p == NOT)))
@@ -848,10 +848,10 @@
 }
 
 #define	swap2(a, b)	{\
-	register void *t; t = *(a); *(a) = *(b); *(b) = t;\
+	void *t; t = *(a); *(a) = *(b); *(b) = t;\
 }
 #define	swap3(a, b, c)	{\
-	register void *t; t = *(a); *(a) = *(c); *(c) = *(b); *(b) = t;\
+	void *t; t = *(a); *(a) = *(c); *(c) = *(b); *(b) = t;\
 }
 
 static void
@@ -859,8 +859,8 @@
 	void **base, **lim;
 	int (*f) ARGS((void *, void *));
 {
-	register void **i, **j;
-	register void **lptr, **hptr;
+	void **i, **j;
+	void **lptr, **hptr;
 	size_t n;
 	int c;
 
Index: syn.c
===================================================================
RCS file: /cvsroot/src/bin/ksh/syn.c,v
retrieving revision 1.10
diff -u -r1.10 syn.c
--- syn.c	30 Jun 2017 04:41:19 -0000	1.10
+++ syn.c	30 Apr 2018 14:13:07 -0000
@@ -85,7 +85,7 @@
 pipeline(cf)
 	int cf;
 {
-	register struct op *t, *p, *tl = NULL;
+	struct op *t, *p, *tl = NULL;
 
 	t = get_command(cf);
 	if (t != NULL) {
@@ -105,8 +105,8 @@
 static struct op *
 andor()
 {
-	register struct op *t, *p;
-	register int c;
+	struct op *t, *p;
+	int c;
 
 	t = pipeline(0);
 	if (t != NULL) {
@@ -124,8 +124,8 @@
 c_list(multi)
 	int multi;
 {
-	register struct op *t = NULL, *p, *tl = NULL;
-	register int c;
+	struct op *t = NULL, *p, *tl = NULL;
+	int c;
 	int have_sep;
 
 	while (1) {
@@ -162,7 +162,7 @@
 synio(cf)
 	int cf;
 {
-	register struct ioword *iop;
+	struct ioword *iop;
 	int ishere;
 
 	if (tpeek(cf) != REDIR)
@@ -195,7 +195,7 @@
 nested(type, smark, emark)
 	int type, smark, emark;
 {
-	register struct op *t;
+	struct op *t;
 	struct nesting_state old_nesting;
 
 	nesting_push(&old_nesting, smark);
@@ -209,8 +209,8 @@
 get_command(cf)
 	int cf;
 {
-	register struct op *t;
-	register int c, iopn = 0, syniocf;
+	struct op *t;
+	int c, iopn = 0, syniocf;
 	struct ioword *iop, **iops;
 	XPtrV args, vars;
 	struct nesting_state old_nesting;
@@ -425,8 +425,8 @@
 static struct op *
 dogroup()
 {
-	register int c;
-	register struct op *list;
+	int c;
+	struct op *list;
 
 	c = token(CONTIN|KEYWORD|ALIAS);
 	/* A {...} can be used instead of do...done for for/select loops
@@ -448,7 +448,7 @@
 static struct op *
 thenpart()
 {
-	register struct op *t;
+	struct op *t;
 
 	musthave(THEN, KEYWORD|ALIAS);
 	t = newtp(0);
@@ -462,7 +462,7 @@
 static struct op *
 elsepart()
 {
-	register struct op *t;
+	struct op *t;
 
 	switch (token(KEYWORD|ALIAS|VARASN)) {
 	  case ELSE:
@@ -485,7 +485,7 @@
 static struct op *
 caselist()
 {
-	register struct op *t, *tl;
+	struct op *t, *tl;
 	int c;
 
 	c = token(CONTIN|KEYWORD|ALIAS);
@@ -512,8 +512,8 @@
 casepart(endtok)
 	int endtok;
 {
-	register struct op *t;
-	register int c;
+	struct op *t;
+	int c;
 	XPtrV ptns;
 
 	XPinit(ptns, 16);
@@ -601,7 +601,7 @@
 static char **
 wordlist()
 {
-	register int c;
+	int c;
 	XPtrV args;
 
 	XPinit(args, 16);
@@ -634,7 +634,7 @@
 	struct op *t1, *t2;
 	char **wp;
 {
-	register struct op *t;
+	struct op *t;
 
 	t = newtp(type);
 	t->left = t1;
@@ -689,8 +689,8 @@
 void
 initkeywords()
 {
-	register struct tokeninfo const *tt;
-	register struct tbl *p;
+	struct tokeninfo const *tt;
+	struct tbl *p;
 
 	tinit(&keywords, APERM, 32); /* must be 2^n (currently 20 keywords) */
 	for (tt = tokentab; tt->name; tt++) {
@@ -777,7 +777,7 @@
 newtp(type)
 	int type;
 {
-	register struct op *t;
+	struct op *t;
 
 	t = (struct op *) alloc(sizeof(*t), ATEMP);
 	t->type = type;
Index: table.c
===================================================================
RCS file: /cvsroot/src/bin/ksh/table.c,v
retrieving revision 1.6
diff -u -r1.6 table.c
--- table.c	24 Jan 2018 09:53:21 -0000	1.6
+++ table.c	30 Apr 2018 14:13:07 -0000
@@ -20,9 +20,9 @@
 
 unsigned int
 hash(n)
-	register const char * n;
+	const char * n;
 {
-	register unsigned int h = 0;
+	unsigned int h = 0;
 
 	while (*n != '\0')
 		h = 2*h + *n++;
@@ -31,8 +31,8 @@
 
 void
 tinit(tp, ap, tsize)
-	register struct table *tp;
-	register Area *ap;
+	struct table *tp;
+	Area *ap;
 	int tsize;
 {
 	tp->areap = ap;
@@ -44,12 +44,12 @@
 
 static void
 texpand(tp, nsize)
-	register struct table *tp;
+	struct table *tp;
 	int nsize;
 {
-	register int i;
-	register struct tbl *tblp, **p;
-	register struct tbl **ntblp, **otblp = tp->tbls;
+	int i;
+	struct tbl *tblp, **p;
+	struct tbl **ntblp, **otblp = tp->tbls;
 	int osize = tp->size;
 
 	ntblp = (struct tbl**) alloc(sizeofN(struct tbl *, nsize), tp->areap);
@@ -80,11 +80,11 @@
 
 struct tbl *
 mytsearch(tp, n, h)
-	register struct table *tp;	/* table */
-	register const char *n;		/* name to enter */
+	struct table *tp;	/* table */
+	const char *n;		/* name to enter */
 	unsigned int h;			/* hash(n) */
 {
-	register struct tbl **pp, *p;
+	struct tbl **pp, *p;
 
 	if (tp->size == 0)
 		return NULL;
@@ -103,12 +103,12 @@
 
 struct tbl *
 tenter(tp, n, h)
-	register struct table *tp;	/* table */
-	register const char *n;		/* name to enter */
+	struct table *tp;	/* table */
+	const char *n;		/* name to enter */
 	unsigned int h;			/* hash(n) */
 {
-	register struct tbl **pp, *p;
-	register int len;
+	struct tbl **pp, *p;
+	int len;
 
 	if (tp->size == 0)
 		texpand(tp, INIT_TBLS);
@@ -145,7 +145,7 @@
 
 void
 mytdelete(p)
-	register struct tbl *p;
+	struct tbl *p;
 {
 	p->flag = 0;
 }
@@ -180,10 +180,10 @@
 
 struct tbl **
 tsort(tp)
-	register struct table *tp;
+	struct table *tp;
 {
-	register int i;
-	register struct tbl **p, **sp, **dp;
+	int i;
+	struct tbl **p, **sp, **dp;
 
 	p = (struct tbl **)alloc(sizeofN(struct tbl *, tp->size+1), ATEMP);
 	sp = tp->tbls;		/* source */
@@ -218,7 +218,7 @@
 	shellf("    Ncmp name\n");
 	twalk(&ts, tp);
 	while ((te = tnext(&ts))) {
-		register struct tbl **pp, *p;
+		struct tbl **pp, *p;
 
 		h = hash(n = te->name);
 		ncmp = 0;
Index: trap.c
===================================================================
RCS file: /cvsroot/src/bin/ksh/trap.c,v
retrieving revision 1.13
diff -u -r1.13 trap.c
--- trap.c	30 Jun 2017 04:41:19 -0000	1.13
+++ trap.c	30 Apr 2018 14:13:07 -0000
@@ -95,7 +95,7 @@
 	int igncase;
 {
 	int i;
-	register Trap *p;
+	Trap *p;
 
 	if (digit(*name)) {
 		int n;
@@ -200,7 +200,7 @@
 	int flag;
 {
 	int i;
-	register Trap *p;
+	Trap *p;
 
 #ifdef KSH
 	if (ksh_tmout_state == TMOUT_LEAVING) {
Index: tree.c
===================================================================
RCS file: /cvsroot/src/bin/ksh/tree.c,v
retrieving revision 1.8
diff -u -r1.8 tree.c
--- tree.c	30 Jun 2017 02:51:14 -0000	1.8
+++ tree.c	30 Apr 2018 14:13:07 -0000
@@ -29,11 +29,11 @@
 
 static void
 ptree(t, indent, shf)
-	register struct op *t;
+	struct op *t;
 	int indent;
-	register struct shf *shf;
+	struct shf *shf;
 {
-	register char **w;
+	char **w;
 	struct ioword **ioact;
 	struct op *t1;
 
@@ -216,9 +216,9 @@
 
 static void
 pioact(shf, indent, iop)
-	register struct shf *shf;
+	struct shf *shf;
 	int indent;
-	register struct ioword *iop;
+	struct ioword *iop;
 {
 	int flag = iop->flag;
 	int type = flag & IOTYPE;
@@ -277,8 +277,8 @@
 
 static void
 tputC(c, shf)
-	register int c;
-	register struct shf *shf;
+	int c;
+	struct shf *shf;
 {
 	if ((c&0x60) == 0) {		/* C0|C1 */
 		tputc((c&0x80) ? '$' : '^', shf);
@@ -292,10 +292,10 @@
 
 static void
 tputS(wp, shf)
-	register char *wp;
-	register struct shf *shf;
+	char *wp;
+	struct shf *shf;
 {
-	register int c, quoted=0;
+	int c, quoted=0;
 
 	/* problems:
 	 *	`...` -> $(...)
@@ -404,17 +404,17 @@
 
 static void
 vfptreef(shf, indent, fmt, va)
-	register struct shf *shf;
+	struct shf *shf;
 	int indent;
 	const char *fmt;
-	register va_list va;
+	va_list va;
 {
-	register int c;
+	int c;
 
 	while ((c = *fmt++))
 	    if (c == '%') {
-		register long n;
-		register char *p;
+		long n;
+		char *p;
 		int neg;
 
 		switch ((c = *fmt++)) {
@@ -476,11 +476,11 @@
 
 struct op *
 tcopy(t, ap)
-	register struct op *t;
+	struct op *t;
 	Area *ap;
 {
-	register struct op *r;
-	register char **tw, **rw;
+	struct op *r;
+	char **tw, **rw;
 
 	if (t == NULL)
 		return NULL;
@@ -537,10 +537,10 @@
 /* return the position of prefix c in wp plus 1 */
 char *
 wdscan(wp, c)
-	register const char *wp;
-	register int c;
+	const char *wp;
+	int c;
 {
-	register int nest = 0;
+	int nest = 0;
 
 	while (1)
 		switch (*wp++) {
@@ -663,18 +663,18 @@
 
 static	struct ioword **
 iocopy(iow, ap)
-	register struct ioword **iow;
+	struct ioword **iow;
 	Area *ap;
 {
-	register struct ioword **ior;
-	register int i;
+	struct ioword **ior;
+	int i;
 
 	for (ior = iow; *ior++ != NULL; )
 		;
 	ior = (struct ioword **) alloc((ior - iow + 1) * sizeof(*ior), ap);
 
 	for (i = 0; iow[i] != NULL; i++) {
-		register struct ioword *p, *q;
+		struct ioword *p, *q;
 
 		p = iow[i];
 		q = (struct ioword *) alloc(sizeof(*p), ap);
@@ -698,10 +698,10 @@
 
 void
 tfree(t, ap)
-	register struct op *t;
+	struct op *t;
 	Area *ap;
 {
-	register char **w;
+	char **w;
 
 	if (t == NULL)
 		return;
@@ -735,8 +735,8 @@
 	struct ioword **iow;
 	Area *ap;
 {
-	register struct ioword **iop;
-	register struct ioword *p;
+	struct ioword **iop;
+	struct ioword *p;
 
 	for (iop = iow; (p = *iop++) != NULL; ) {
 		if (p->name != NULL)
Index: var.c
===================================================================
RCS file: /cvsroot/src/bin/ksh/var.c,v
retrieving revision 1.23
diff -u -r1.23 var.c
--- var.c	24 Jan 2018 09:53:21 -0000	1.23
+++ var.c	30 Apr 2018 14:13:07 -0000
@@ -42,7 +42,7 @@
 void
 newblock()
 {
-	register struct block *l;
+	struct block *l;
 	static char *const empty[] = {null};
 
 	l = (struct block *) alloc(sizeof(struct block), ATEMP);
@@ -68,9 +68,9 @@
 void
 popblock()
 {
-	register struct block *l = e->loc;
-	register struct tbl *vp, **vpp = l->vars.tbls, *vq;
-	register int i;
+	struct block *l = e->loc;
+	struct tbl *vp, **vpp = l->vars.tbls, *vq;
+	int i;
 
 	e->loc = l->next;	/* pop block */
 	for (i = l->vars.size; --i >= 0; ) {
@@ -172,11 +172,11 @@
  */
 struct tbl *
 global(n)
-	register const char *n;
+	const char *n;
 {
-	register struct block *l = e->loc;
-	register struct tbl *vp;
-	register int c;
+	struct block *l = e->loc;
+	struct tbl *vp;
+	int c;
 	unsigned h;
 	bool	 array;
 	int	 val;
@@ -256,8 +256,8 @@
 struct tbl *
 local(const char *n, bool copy)
 {
-	register struct block *l = e->loc;
-	register struct tbl *vp;
+	struct block *l = e->loc;
+	struct tbl *vp;
 	unsigned h;
 	bool	 array;
 	int	 val;
@@ -299,7 +299,7 @@
 /* get variable string value */
 char *
 str_val(vp)
-	register struct tbl *vp;
+	struct tbl *vp;
 {
 	char *s;
 
@@ -316,8 +316,8 @@
 		const char *digits = (vp->flag & UCASEV_AL) ?
 				  "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 				: "0123456789abcdefghijklmnopqrstuvwxyz";
-		register unsigned long n;
-		register int base;
+		unsigned long n;
+		int base;
 
 		s = strbuf + sizeof(strbuf);
 		if (vp->flag & INT_U)
@@ -352,7 +352,7 @@
 /* get variable integer value, with error checking */
 long
 intval(vp)
-	register struct tbl *vp;
+	struct tbl *vp;
 {
 	long num;
 	int base;
@@ -367,7 +367,7 @@
 /* set variable to string value */
 int
 setstr(vq, s, error_ok)
-	register struct tbl *vq;
+	struct tbl *vq;
 	const char *s;
 	int error_ok;
 {
@@ -414,11 +414,11 @@
 /* set variable to integer */
 void
 setint(vq, n)
-	register struct tbl *vq;
+	struct tbl *vq;
 	long n;
 {
 	if (!(vq->flag&INTEGER)) {
-		register struct tbl *vp = &vtemp;
+		struct tbl *vp = &vtemp;
 		vp->flag = (ISSET|INTEGER);
 		vp->type = 0;
 		vp->areap = ATEMP;
@@ -437,8 +437,8 @@
 	struct tbl *vp;
 	long *nump;
 {
-	register char *s;
-	register int c;
+	char *s;
+	int c;
 	int base, neg;
 	int have_base = 0;
 	long num;
@@ -500,7 +500,7 @@
  */
 struct tbl *
 setint_v(vq, vp)
-	register struct tbl *vq, *vp;
+	struct tbl *vq, *vp;
 {
 	int base;
 	long num;
@@ -586,10 +586,10 @@
  */
 static void
 export(vp, val)
-	register struct tbl *vp;
+	struct tbl *vp;
 	const char *val;
 {
-	register char *xp;
+	char *xp;
 	char *op = (vp->flag&ALLOC) ? vp->val.s : NULL;
 	int namelen = strlen(vp->name);
 	int vallen = strlen(val) + 1;
@@ -612,11 +612,11 @@
  */
 struct tbl *
 typeset(var, set, clr, field, base)
-	register const char *var;
+	const char *var;
 	Tflag clr, set;
 	int field, base;
 {
-	register struct tbl *vp;
+	struct tbl *vp;
 	struct tbl *vpbase, *t;
 	char *tvar;
 	const char *val;
@@ -766,7 +766,7 @@
  */
 void
 unset(vp, array_ref)
-	register struct tbl *vp;
+	struct tbl *vp;
 	int array_ref;
 {
 	if (vp->flag & ALLOC)
@@ -872,16 +872,16 @@
 {
 	struct block *l = e->loc;
 	XPtrV env;
-	register struct tbl *vp, **vpp;
-	register int i;
+	struct tbl *vp, **vpp;
+	int i;
 
 	XPinit(env, 64);
 	for (l = e->loc; l != NULL; l = l->next)
 		for (vpp = l->vars.tbls, i = l->vars.size; --i >= 0; )
 			if ((vp = *vpp++) != NULL
 			    && (vp->flag&(ISSET|EXPORT)) == (ISSET|EXPORT)) {
-				register struct block *l2;
-				register struct tbl *vp2;
+				struct block *l2;
+				struct tbl *vp2;
 				unsigned h = hash(vp->name);
 
 				/* unexport any redefined instances */
@@ -922,9 +922,9 @@
 /* Test if name is a special parameter */
 static int
 special(name)
-	register const char * name;
+	const char * name;
 {
-	register struct tbl *tp;
+	struct tbl *tp;
 
 	tp = mytsearch(&specials, name, hash(name));
 	return tp && (tp->flag & ISSET) ? tp->type : V_NONE;
@@ -933,9 +933,9 @@
 /* Make a variable non-special */
 static void
 unspecial(name)
-	register const char * name;
+	const char * name;
 {
-	register struct tbl *tp;
+	struct tbl *tp;
 
 	tp = mytsearch(&specials, name, hash(name));
 	if (tp)
@@ -949,7 +949,7 @@
 
 static void
 getspec(vp)
-	register struct tbl *vp;
+	struct tbl *vp;
 {
 	switch (special(vp->name)) {
 #ifdef KSH
@@ -991,7 +991,7 @@
 
 static void
 setspec(vp)
-	register struct tbl *vp;
+	struct tbl *vp;
 {
 	char *s;
 
@@ -1092,7 +1092,7 @@
 
 static void
 unsetspec(vp)
-	register struct tbl *vp;
+	struct tbl *vp;
 {
 	switch (special(vp->name)) {
 	  case V_PATH:
Index: vi.c
===================================================================
RCS file: /cvsroot/src/bin/ksh/vi.c,v
retrieving revision 1.19
diff -u -r1.19 vi.c
--- vi.c	24 Jan 2018 09:53:21 -0000	1.19
+++ vi.c	30 Apr 2018 14:13:07 -0000
@@ -1781,7 +1781,7 @@
 static void
 rewindow()
 {
-	register int	tcur, tcol;
+	int		tcur, tcol;
 	int		holdcur1, holdcol1;
 	int		holdcur2, holdcol2;
 



Home | Main Index | Thread Index | Old Index