From 08d781a2fb49b10c99922100b2b91f690440afb2 Mon Sep 17 00:00:00 2001 From: tg Date: Tue, 28 Dec 2004 22:37:23 +0000 Subject: [PATCH] Replace home rolled unsigned char type with u_char. From: Jonathan Gray --- emacs.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/emacs.c b/emacs.c index 5696e37..4f2ca21 100644 --- a/emacs.c +++ b/emacs.c @@ -1,5 +1,5 @@ -/** $MirBSD: src/bin/ksh/emacs.c,v 2.6 2004/12/28 22:32:08 tg Exp $ */ -/* $OpenBSD: emacs.c,v 1.28 2003/10/22 07:40:38 jmc Exp $ */ +/** $MirBSD: src/bin/ksh/emacs.c,v 2.7 2004/12/28 22:37:23 tg Exp $ */ +/* $OpenBSD: emacs.c,v 1.34 2004/12/23 11:29:02 jsg Exp $ */ /* * Emacs-like command line editing and history @@ -18,7 +18,7 @@ #include #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; #define AEDIT &aedit /* area for kill ring and macro defns */ @@ -41,11 +41,8 @@ struct x_ftab { short xf_flags; }; -/* index into struct x_ftab x_ftab[] - small is good */ -typedef unsigned char Findex; - struct x_defbindings { - Findex xdb_func; /* XFUNC_* */ + u_char xdb_func; /* XFUNC_* */ unsigned char xdb_tab; unsigned char xdb_char; }; @@ -102,8 +99,8 @@ static int x_prefix1 = CTRL('['), x_prefix2 = CTRL('X'); static char **x_histp; /* history position */ static int x_nextcmd; /* for newline-and-next */ static char *xmp; /* mark pointer */ -static Findex x_last_command; -static Findex (*x_tab)[X_TABSZ]; /* key definition */ +static u_char x_last_command; +static u_char (*x_tab)[X_TABSZ]; /* key definition */ static char *(*x_atab)[X_TABSZ]; /* macro definitions */ static unsigned char x_bound[(X_TABSZ * X_NTABS + 7) / 8]; #define KILLSIZE 20 @@ -310,7 +307,7 @@ x_emacs(char *buf, size_t len) int c; const char *p; int i; - Findex f; + u_char f; xbp = xbuf = buf; xend = buf + len; 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 */ char pat [256+1]; /* pattern buffer */ char *p = pat; - Findex f; + u_char f; *p = '\0'; while (1) { @@ -1325,7 +1322,7 @@ x_bind(const char *a1, const char *a2, int macro, int list) /* bind -m */ /* bind -l */ { - Findex f; + u_char f; int prefix, key; char *sp = NULL; char *m1, *m2; @@ -1416,7 +1413,7 @@ x_init_emacs(void) ainit(AEDIT); 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++) x_tab[0][j] = XFUNC_insert; for (i = 1; i < X_NTABS; i++)