Replace home rolled unsigned char type with u_char.

From: Jonathan Gray <jsg@cvs.openbsd.org>
This commit is contained in:
tg 2004-12-28 22:37:23 +00:00
parent 337bd6717f
commit 08d781a2fb

23
emacs.c
View File

@ -1,5 +1,5 @@
/** $MirBSD: src/bin/ksh/emacs.c,v 2.6 2004/12/28 22:32:08 tg Exp $ */ /** $MirBSD: src/bin/ksh/emacs.c,v 2.7 2004/12/28 22:37:23 tg Exp $ */
/* $OpenBSD: emacs.c,v 1.28 2003/10/22 07:40:38 jmc Exp $ */ /* $OpenBSD: emacs.c,v 1.34 2004/12/23 11:29:02 jsg Exp $ */
/* /*
* Emacs-like command line editing and history * Emacs-like command line editing and history
@ -18,7 +18,7 @@
#include <locale.h> #include <locale.h>
#include "edit.h" #include "edit.h"
__RCSID("$MirBSD: src/bin/ksh/emacs.c,v 2.6 2004/12/28 22:32:08 tg Exp $"); __RCSID("$MirBSD: src/bin/ksh/emacs.c,v 2.7 2004/12/28 22:37:23 tg Exp $");
static Area aedit; static Area aedit;
#define AEDIT &aedit /* area for kill ring and macro defns */ #define AEDIT &aedit /* area for kill ring and macro defns */
@ -41,11 +41,8 @@ struct x_ftab {
short xf_flags; short xf_flags;
}; };
/* index into struct x_ftab x_ftab[] - small is good */
typedef unsigned char Findex;
struct x_defbindings { struct x_defbindings {
Findex xdb_func; /* XFUNC_* */ u_char xdb_func; /* XFUNC_* */
unsigned char xdb_tab; unsigned char xdb_tab;
unsigned char xdb_char; unsigned char xdb_char;
}; };
@ -102,8 +99,8 @@ static int x_prefix1 = CTRL('['), x_prefix2 = CTRL('X');
static char **x_histp; /* history position */ static char **x_histp; /* history position */
static int x_nextcmd; /* for newline-and-next */ static int x_nextcmd; /* for newline-and-next */
static char *xmp; /* mark pointer */ static char *xmp; /* mark pointer */
static Findex x_last_command; static u_char x_last_command;
static Findex (*x_tab)[X_TABSZ]; /* key definition */ static u_char (*x_tab)[X_TABSZ]; /* key definition */
static char *(*x_atab)[X_TABSZ]; /* macro definitions */ static char *(*x_atab)[X_TABSZ]; /* macro definitions */
static unsigned char x_bound[(X_TABSZ * X_NTABS + 7) / 8]; static unsigned char x_bound[(X_TABSZ * X_NTABS + 7) / 8];
#define KILLSIZE 20 #define KILLSIZE 20
@ -310,7 +307,7 @@ x_emacs(char *buf, size_t len)
int c; int c;
const char *p; const char *p;
int i; int i;
Findex f; u_char f;
xbp = xbuf = buf; xend = buf + len; xbp = xbuf = buf; xend = buf + len;
xlp = xcp = xep = buf; xlp = xcp = xep = buf;
@ -885,7 +882,7 @@ x_search_hist(int c GCC_FUNC_ATTR(unused))
int offset = -1; /* offset of match in xbuf, else -1 */ int offset = -1; /* offset of match in xbuf, else -1 */
char pat [256+1]; /* pattern buffer */ char pat [256+1]; /* pattern buffer */
char *p = pat; char *p = pat;
Findex f; u_char f;
*p = '\0'; *p = '\0';
while (1) { while (1) {
@ -1325,7 +1322,7 @@ x_bind(const char *a1, const char *a2, int macro, int list)
/* bind -m */ /* bind -m */
/* bind -l */ /* bind -l */
{ {
Findex f; u_char f;
int prefix, key; int prefix, key;
char *sp = NULL; char *sp = NULL;
char *m1, *m2; char *m1, *m2;
@ -1416,7 +1413,7 @@ x_init_emacs(void)
ainit(AEDIT); ainit(AEDIT);
x_nextcmd = -1; x_nextcmd = -1;
x_tab = (Findex (*)[X_TABSZ]) alloc(sizeofN(*x_tab, X_NTABS), AEDIT); x_tab = (u_char (*)[X_TABSZ]) alloc(sizeofN(*x_tab, X_NTABS), AEDIT);
for (j = 0; j < X_TABSZ; j++) for (j = 0; j < X_TABSZ; j++)
x_tab[0][j] = XFUNC_insert; x_tab[0][j] = XFUNC_insert;
for (i = 1; i < X_NTABS; i++) for (i = 1; i < X_NTABS; i++)