diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2016-01-30 17:32:53 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2016-01-30 17:32:53 +0000 |
commit | d1ec769799b45cbcf9aa8e23df4d354dc487625a (patch) | |
tree | 4df0e61127ed12979816be824a3d3a38cf556b48 /lib/libedit | |
parent | 6ef516ee5df5d88f456513181817254692408279 (diff) |
Fifth step in synching with NetBSD:
Delete the silly ptr_t and ioctl_t typedefs
and delete some "#ifdef notdef" code from "sys.h".
No functional change.
This makes hist.h identical to the NetBSD version.
It reduces the remaining diff from +1526 -734 to +1430 -592.
OK czarkoff@
Diffstat (limited to 'lib/libedit')
-rw-r--r-- | lib/libedit/chared.c | 14 | ||||
-rw-r--r-- | lib/libedit/el.c | 16 | ||||
-rw-r--r-- | lib/libedit/eln.c | 4 | ||||
-rw-r--r-- | lib/libedit/hist.c | 8 | ||||
-rw-r--r-- | lib/libedit/hist.h | 14 | ||||
-rw-r--r-- | lib/libedit/histedit.h | 4 | ||||
-rw-r--r-- | lib/libedit/history.c | 78 | ||||
-rw-r--r-- | lib/libedit/keymacro.c | 14 | ||||
-rw-r--r-- | lib/libedit/map.c | 10 | ||||
-rw-r--r-- | lib/libedit/read.c | 8 | ||||
-rw-r--r-- | lib/libedit/search.c | 6 | ||||
-rw-r--r-- | lib/libedit/sys.h | 48 | ||||
-rw-r--r-- | lib/libedit/terminal.c | 22 | ||||
-rw-r--r-- | lib/libedit/tokenizer.c | 22 | ||||
-rw-r--r-- | lib/libedit/vi.c | 4 |
15 files changed, 113 insertions, 159 deletions
diff --git a/lib/libedit/chared.c b/lib/libedit/chared.c index da3d9224cd1..450c75858d9 100644 --- a/lib/libedit/chared.c +++ b/lib/libedit/chared.c @@ -1,4 +1,4 @@ -/* $OpenBSD: chared.c,v 1.15 2016/01/30 12:22:20 schwarze Exp $ */ +/* $OpenBSD: chared.c,v 1.16 2016/01/30 17:32:52 schwarze Exp $ */ /* $NetBSD: chared.c,v 1.28 2009/12/30 22:37:40 christos Exp $ */ /*- @@ -482,7 +482,7 @@ ch__clearmacro(EditLine *el) { c_macro_t *ma = &el->el_chared.c_macro; while (ma->level >= 0) - free((ptr_t)ma->macro[ma->level--]); + free(ma->macro[ma->level--]); } /* ch_enlargebufs(): @@ -582,20 +582,20 @@ ch_enlargebufs(EditLine *el, size_t addlen) protected void ch_end(EditLine *el) { - free((ptr_t) el->el_line.buffer); + free(el->el_line.buffer); el->el_line.buffer = NULL; el->el_line.limit = NULL; - free((ptr_t) el->el_chared.c_undo.buf); + free(el->el_chared.c_undo.buf); el->el_chared.c_undo.buf = NULL; - free((ptr_t) el->el_chared.c_redo.buf); + free(el->el_chared.c_redo.buf); el->el_chared.c_redo.buf = NULL; el->el_chared.c_redo.pos = NULL; el->el_chared.c_redo.lim = NULL; el->el_chared.c_redo.cmd = ED_UNASSIGNED; - free((ptr_t) el->el_chared.c_kill.buf); + free(el->el_chared.c_kill.buf); el->el_chared.c_kill.buf = NULL; ch_reset(el, 1); - free((ptr_t) el->el_chared.c_macro.macro); + free(el->el_chared.c_macro.macro); el->el_chared.c_macro.macro = NULL; } diff --git a/lib/libedit/el.c b/lib/libedit/el.c index b0fd3e5c85b..261596b5e4f 100644 --- a/lib/libedit/el.c +++ b/lib/libedit/el.c @@ -1,4 +1,4 @@ -/* $OpenBSD: el.c,v 1.23 2016/01/30 12:22:20 schwarze Exp $ */ +/* $OpenBSD: el.c,v 1.24 2016/01/30 17:32:52 schwarze Exp $ */ /* $NetBSD: el.c,v 1.61 2011/01/27 23:11:40 christos Exp $ */ /*- @@ -128,14 +128,14 @@ el_end(EditLine *el) prompt_end(el); sig_end(el); - free((ptr_t) el->el_prog); + free(el->el_prog); #ifdef WIDECHAR - free((ptr_t) el->el_scratch.cbuff); - free((ptr_t) el->el_scratch.wbuff); - free((ptr_t) el->el_lgcyconv.cbuff); - free((ptr_t) el->el_lgcyconv.wbuff); + free(el->el_scratch.cbuff); + free(el->el_scratch.wbuff); + free(el->el_lgcyconv.cbuff); + free(el->el_lgcyconv.wbuff); #endif - free((ptr_t) el); + free(el); } @@ -264,7 +264,7 @@ FUN(el,set)(EditLine *el, int op, ...) case EL_HIST: { hist_fun_t func = va_arg(ap, hist_fun_t); - ptr_t ptr = va_arg(ap, ptr_t); + void *ptr = va_arg(ap, void *); rv = hist_set(el, func, ptr); if (!(el->el_flags & CHARSET_IS_UTF8)) diff --git a/lib/libedit/eln.c b/lib/libedit/eln.c index 728b74f4b1f..533e361a822 100644 --- a/lib/libedit/eln.c +++ b/lib/libedit/eln.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eln.c,v 1.5 2016/01/30 00:06:39 schwarze Exp $ */ +/* $OpenBSD: eln.c,v 1.6 2016/01/30 17:32:52 schwarze Exp $ */ /* $NetBSD: eln.c,v 1.9 2010/11/04 13:53:12 christos Exp $ */ /*- @@ -213,7 +213,7 @@ el_set(EditLine *el, int op, ...) } case EL_HIST: { /* hist_fun_t, const char * */ hist_fun_t fun = va_arg(ap, hist_fun_t); - ptr_t ptr = va_arg(ap, ptr_t); + void *ptr = va_arg(ap, void *); ret = hist_set(el, fun, ptr); el->el_flags |= NARROW_HISTORY; break; diff --git a/lib/libedit/hist.c b/lib/libedit/hist.c index 7440437747a..cc181453f98 100644 --- a/lib/libedit/hist.c +++ b/lib/libedit/hist.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hist.c,v 1.11 2016/01/30 12:22:20 schwarze Exp $ */ +/* $OpenBSD: hist.c,v 1.12 2016/01/30 17:32:52 schwarze Exp $ */ /* $NetBSD: hist.c,v 1.17 2009/12/30 23:54:52 christos Exp $ */ /*- @@ -67,7 +67,7 @@ protected void hist_end(EditLine *el) { - free((ptr_t) el->el_history.buf); + free(el->el_history.buf); el->el_history.buf = NULL; } @@ -76,7 +76,7 @@ hist_end(EditLine *el) * Set new history interface */ protected int -hist_set(EditLine *el, hist_fun_t fun, ptr_t ptr) +hist_set(EditLine *el, hist_fun_t fun, void *ptr) { el->el_history.ref = ptr; @@ -207,7 +207,7 @@ hist_enlargebuf(EditLine *el, size_t oldsz, size_t newsz) #ifdef WIDECHAR protected wchar_t * -hist_convert(EditLine *el, int fn, ptr_t arg) +hist_convert(EditLine *el, int fn, void *arg) { HistEventW ev; if ((*(el)->el_history.fun)((el)->el_history.ref, &ev, fn, arg) == -1) diff --git a/lib/libedit/hist.h b/lib/libedit/hist.h index 246d4d974c3..ebc4982c607 100644 --- a/lib/libedit/hist.h +++ b/lib/libedit/hist.h @@ -1,5 +1,5 @@ -/* $OpenBSD: hist.h,v 1.9 2014/05/19 08:58:34 nicm Exp $ */ -/* $NetBSD: hist.h,v 1.12 2009/12/30 23:54:52 christos Exp $ */ +/* $OpenBSD: hist.h,v 1.10 2016/01/30 17:32:52 schwarze Exp $ */ +/* $NetBSD: hist.h,v 1.14 2014/05/11 01:05:17 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -43,14 +43,14 @@ #include "histedit.h" -typedef int (*hist_fun_t)(ptr_t, TYPE(HistEvent) *, int, ...); +typedef int (*hist_fun_t)(void *, TYPE(HistEvent) *, int, ...); typedef struct el_history_t { Char *buf; /* The history buffer */ - size_t sz; /* Size of history buffer */ + size_t sz; /* Size of history buffer */ Char *last; /* The last character */ int eventno; /* Event we are looking for */ - ptr_t ref; /* Argument for history fcns */ + void *ref; /* Argument for history fcns */ hist_fun_t fun; /* Event access */ TYPE(HistEvent) ev; /* Event cookie */ } el_history_t; @@ -79,11 +79,11 @@ typedef struct el_history_t { protected int hist_init(EditLine *); protected void hist_end(EditLine *); protected el_action_t hist_get(EditLine *); -protected int hist_set(EditLine *, hist_fun_t, ptr_t); +protected int hist_set(EditLine *, hist_fun_t, void *); protected int hist_command(EditLine *, int, const Char **); protected int hist_enlargebuf(EditLine *, size_t, size_t); #ifdef WIDECHAR -protected wchar_t *hist_convert(EditLine *, int, ptr_t); +protected wchar_t *hist_convert(EditLine *, int, void *); #endif #endif /* _h_el_hist */ diff --git a/lib/libedit/histedit.h b/lib/libedit/histedit.h index 7213c4e0b4d..909e685dc9e 100644 --- a/lib/libedit/histedit.h +++ b/lib/libedit/histedit.h @@ -1,4 +1,4 @@ -/* $OpenBSD: histedit.h,v 1.12 2014/05/19 08:58:34 nicm Exp $ */ +/* $OpenBSD: histedit.h,v 1.13 2016/01/30 17:32:52 schwarze Exp $ */ /* $NetBSD: histedit.h,v 1.46 2010/04/15 00:50:03 christos Exp $ */ /*- @@ -143,7 +143,7 @@ unsigned char _el_fn_complete(EditLine *, int); #define EL_SETTY 8 /* , const Char *, ..., NULL); set */ #define EL_ADDFN 9 /* , const Char *, const Char, set */ /* el_func_t); */ -#define EL_HIST 10 /* , hist_fun_t, const ptr_t); set */ +#define EL_HIST 10 /* , hist_fun_t, const void *); set */ #define EL_EDITMODE 11 /* , int); set/get */ #define EL_RPROMPT 12 /* , prompt_func); set/get */ #define EL_GETCFN 13 /* , el_rfunc_t); set/get */ diff --git a/lib/libedit/history.c b/lib/libedit/history.c index d978522d37c..cbe9d0ce33b 100644 --- a/lib/libedit/history.c +++ b/lib/libedit/history.c @@ -1,4 +1,4 @@ -/* $OpenBSD: history.c,v 1.20 2016/01/30 12:22:20 schwarze Exp $ */ +/* $OpenBSD: history.c,v 1.21 2016/01/30 17:32:52 schwarze Exp $ */ /* $NetBSD: history.c,v 1.37 2010/01/03 18:27:10 christos Exp $ */ /*- @@ -53,13 +53,13 @@ static const char hist_cookie[] = "_HiStOrY_V2_\n"; #include "histedit.h" #include "chartype.h" -typedef int (*history_gfun_t)(ptr_t, TYPE(HistEvent) *); -typedef int (*history_efun_t)(ptr_t, TYPE(HistEvent) *, const Char *); -typedef void (*history_vfun_t)(ptr_t, TYPE(HistEvent) *); -typedef int (*history_sfun_t)(ptr_t, TYPE(HistEvent) *, const int); +typedef int (*history_gfun_t)(void *, TYPE(HistEvent) *); +typedef int (*history_efun_t)(void *, TYPE(HistEvent) *, const Char *); +typedef void (*history_vfun_t)(void *, TYPE(HistEvent) *); +typedef int (*history_sfun_t)(void *, TYPE(HistEvent) *, const int); struct TYPE(history) { - ptr_t h_ref; /* Argument for history fcns */ + void *h_ref; /* Argument for history fcns */ int h_ent; /* Last entry point for history */ history_gfun_t h_first; /* Get the first element */ history_gfun_t h_next; /* Get the next element */ @@ -129,23 +129,23 @@ typedef struct history_t { #define H_UNIQUE 1 /* Store only unique elements */ } history_t; -private int history_def_next(ptr_t, TYPE(HistEvent) *); -private int history_def_first(ptr_t, TYPE(HistEvent) *); -private int history_def_prev(ptr_t, TYPE(HistEvent) *); -private int history_def_last(ptr_t, TYPE(HistEvent) *); -private int history_def_curr(ptr_t, TYPE(HistEvent) *); -private int history_def_set(ptr_t, TYPE(HistEvent) *, const int); -private void history_def_clear(ptr_t, TYPE(HistEvent) *); -private int history_def_enter(ptr_t, TYPE(HistEvent) *, const Char *); -private int history_def_add(ptr_t, TYPE(HistEvent) *, const Char *); -private int history_def_del(ptr_t, TYPE(HistEvent) *, const int); - -private int history_def_init(ptr_t *, TYPE(HistEvent) *, int); +private int history_def_next(void *, TYPE(HistEvent) *); +private int history_def_first(void *, TYPE(HistEvent) *); +private int history_def_prev(void *, TYPE(HistEvent) *); +private int history_def_last(void *, TYPE(HistEvent) *); +private int history_def_curr(void *, TYPE(HistEvent) *); +private int history_def_set(void *, TYPE(HistEvent) *, const int); +private void history_def_clear(void *, TYPE(HistEvent) *); +private int history_def_enter(void *, TYPE(HistEvent) *, const Char *); +private int history_def_add(void *, TYPE(HistEvent) *, const Char *); +private int history_def_del(void *, TYPE(HistEvent) *, const int); + +private int history_def_init(void **, TYPE(HistEvent) *, int); private int history_def_insert(history_t *, TYPE(HistEvent) *, const Char *); private void history_def_delete(history_t *, TYPE(HistEvent) *, hentry_t *); private int history_deldata_nth(history_t *, TYPE(HistEvent) *, int, void **); -private int history_set_nth(ptr_t, TYPE(HistEvent) *, int); +private int history_set_nth(void *, TYPE(HistEvent) *, int); #define history_def_setsize(p, num)(void) (((history_t *)p)->max = (num)) #define history_def_getsize(p) (((history_t *)p)->cur) @@ -203,7 +203,7 @@ static const Char *const he_errlist[] = { * Default function to return the first event in the history. */ private int -history_def_first(ptr_t p, TYPE(HistEvent) *ev) +history_def_first(void *p, TYPE(HistEvent) *ev) { history_t *h = (history_t *) p; @@ -223,7 +223,7 @@ history_def_first(ptr_t p, TYPE(HistEvent) *ev) * Default function to return the last event in the history. */ private int -history_def_last(ptr_t p, TYPE(HistEvent) *ev) +history_def_last(void *p, TYPE(HistEvent) *ev) { history_t *h = (history_t *) p; @@ -243,7 +243,7 @@ history_def_last(ptr_t p, TYPE(HistEvent) *ev) * Default function to return the next event in the history. */ private int -history_def_next(ptr_t p, TYPE(HistEvent) *ev) +history_def_next(void *p, TYPE(HistEvent) *ev) { history_t *h = (history_t *) p; @@ -268,7 +268,7 @@ history_def_next(ptr_t p, TYPE(HistEvent) *ev) * Default function to return the previous event in the history. */ private int -history_def_prev(ptr_t p, TYPE(HistEvent) *ev) +history_def_prev(void *p, TYPE(HistEvent) *ev) { history_t *h = (history_t *) p; @@ -294,7 +294,7 @@ history_def_prev(ptr_t p, TYPE(HistEvent) *ev) * Default function to return the current event in the history. */ private int -history_def_curr(ptr_t p, TYPE(HistEvent) *ev) +history_def_curr(void *p, TYPE(HistEvent) *ev) { history_t *h = (history_t *) p; @@ -315,7 +315,7 @@ history_def_curr(ptr_t p, TYPE(HistEvent) *ev) * given one. */ private int -history_def_set(ptr_t p, TYPE(HistEvent) *ev, const int n) +history_def_set(void *p, TYPE(HistEvent) *ev, const int n) { history_t *h = (history_t *) p; @@ -342,7 +342,7 @@ history_def_set(ptr_t p, TYPE(HistEvent) *ev, const int n) * n-th one. */ private int -history_set_nth(ptr_t p, TYPE(HistEvent) *ev, int n) +history_set_nth(void *p, TYPE(HistEvent) *ev, int n) { history_t *h = (history_t *) p; @@ -366,7 +366,7 @@ history_set_nth(ptr_t p, TYPE(HistEvent) *ev, int n) * Append string to element */ private int -history_def_add(ptr_t p, TYPE(HistEvent) *ev, const Char *str) +history_def_add(void *p, TYPE(HistEvent) *ev, const Char *str) { history_t *h = (history_t *) p; size_t len; @@ -384,7 +384,7 @@ history_def_add(ptr_t p, TYPE(HistEvent) *ev, const Char *str) (void) Strncpy(s, h->cursor->ev.str, len); s[len - 1] = '\0'; (void) Strncat(s, str, len - Strlen(s) - 1); - free((ptr_t)evp->str); + free(evp->str); evp->str = s; *ev = h->cursor->ev; return 0; @@ -414,7 +414,7 @@ history_deldata_nth(history_t *h, TYPE(HistEvent) *ev, */ /* ARGSUSED */ private int -history_def_del(ptr_t p, TYPE(HistEvent) *ev __attribute__((__unused__)), +history_def_del(void *p, TYPE(HistEvent) *ev __attribute__((__unused__)), const int num) { history_t *h = (history_t *) p; @@ -445,7 +445,7 @@ history_def_delete(history_t *h, } hp->prev->next = hp->next; hp->next->prev = hp->prev; - free((ptr_t) evp->str); + free(evp->str); free(hp); h->cur--; } @@ -462,7 +462,7 @@ history_def_insert(history_t *h, TYPE(HistEvent) *ev, const Char *str) if (h->cursor == NULL) goto oomem; if ((h->cursor->ev.str = h_strdup(str)) == NULL) { - free((ptr_t)h->cursor); + free(h->cursor); goto oomem; } h->cursor->data = NULL; @@ -485,7 +485,7 @@ oomem: * Default function to enter an item in the history */ private int -history_def_enter(ptr_t p, TYPE(HistEvent) *ev, const Char *str) +history_def_enter(void *p, TYPE(HistEvent) *ev, const Char *str) { history_t *h = (history_t *) p; @@ -512,7 +512,7 @@ history_def_enter(ptr_t p, TYPE(HistEvent) *ev, const Char *str) */ /* ARGSUSED */ private int -history_def_init(ptr_t *p, TYPE(HistEvent) *ev __attribute__((__unused__)), int n) +history_def_init(void **p, TYPE(HistEvent) *ev __attribute__((__unused__)), int n) { history_t *h = (history_t *) malloc(sizeof(history_t)); if (h == NULL) @@ -528,7 +528,7 @@ history_def_init(ptr_t *p, TYPE(HistEvent) *ev __attribute__((__unused__)), int h->list.ev.num = 0; h->cursor = &h->list; h->flags = 0; - *p = (ptr_t) h; + *p = h; return 0; } @@ -537,7 +537,7 @@ history_def_init(ptr_t *p, TYPE(HistEvent) *ev __attribute__((__unused__)), int * Default history cleanup function */ private void -history_def_clear(ptr_t p, TYPE(HistEvent) *ev) +history_def_clear(void *p, TYPE(HistEvent) *ev) { history_t *h = (history_t *) p; @@ -564,7 +564,7 @@ FUN(history,init)(void) return NULL; if (history_def_init(&h->h_ref, &ev, 0) == -1) { - free((ptr_t)h); + free(h); return NULL; } h->h_ent = -1; @@ -774,7 +774,7 @@ history_load(TYPE(History) *h, const char *fname) } } oomem: - free((ptr_t)ptr); + free(ptr); done: free(lbuf); (void) fclose(fp); @@ -822,7 +822,7 @@ history_save_fp(TYPE(History) *h, FILE *fp) (void) fprintf(fp, "%s\n", ptr); } oomem: - free((ptr_t)ptr); + free(ptr); done: return i; } @@ -1053,7 +1053,7 @@ FUNW(history)(TYPE(History) *h, TYPE(HistEvent) *ev, int fun, ...) { TYPE(History) hf; - hf.h_ref = va_arg(va, ptr_t); + hf.h_ref = va_arg(va, void *); h->h_ent = -1; hf.h_first = va_arg(va, history_gfun_t); hf.h_next = va_arg(va, history_gfun_t); diff --git a/lib/libedit/keymacro.c b/lib/libedit/keymacro.c index 3c64f94ff48..bfbb81aeda1 100644 --- a/lib/libedit/keymacro.c +++ b/lib/libedit/keymacro.c @@ -1,4 +1,4 @@ -/* $OpenBSD: keymacro.c,v 1.3 2016/01/30 12:22:20 schwarze Exp $ */ +/* $OpenBSD: keymacro.c,v 1.4 2016/01/30 17:32:52 schwarze Exp $ */ /* $NetBSD: key.c,v 1.23 2009/12/30 22:37:40 christos Exp $ */ /*- @@ -36,8 +36,8 @@ #include "config.h" /* - * key.c: This module contains the procedures for maintaining - * the extended-key map. + * keymacro.c: This module contains the procedures for maintaining + * the extended-key map. * * An extended-key (key) is a sequence of keystrokes introduced * with a sequence introducer and consisting of an arbitrary @@ -337,7 +337,7 @@ node__try(EditLine *el, keymacro_node_t *ptr, const Char *str, case XK_STR: case XK_EXE: if (ptr->val.str) - free((ptr_t) ptr->val.str); + free(ptr->val.str); break; default: EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", @@ -438,13 +438,13 @@ node__put(EditLine *el, keymacro_node_t *ptr) case XK_EXE: case XK_STR: if (ptr->val.str != NULL) - free((ptr_t) ptr->val.str); + free(ptr->val.str); break; default: EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ptr->type)); break; } - free((ptr_t) ptr); + free(ptr); } @@ -474,7 +474,7 @@ node__free(keymacro_node_t *k) return; node__free(k->sibling); node__free(k->next); - free((ptr_t) k); + free(k); } /* node_lookup(): diff --git a/lib/libedit/map.c b/lib/libedit/map.c index 546778468c4..5630b63bc17 100644 --- a/lib/libedit/map.c +++ b/lib/libedit/map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: map.c,v 1.15 2016/01/30 12:22:20 schwarze Exp $ */ +/* $OpenBSD: map.c,v 1.16 2016/01/30 17:32:52 schwarze Exp $ */ /* $NetBSD: map.c,v 1.25 2009/12/30 22:37:40 christos Exp $ */ /*- @@ -935,16 +935,16 @@ protected void map_end(EditLine *el) { - free((ptr_t) el->el_map.alt); + free(el->el_map.alt); el->el_map.alt = NULL; - free((ptr_t) el->el_map.key); + free(el->el_map.key); el->el_map.key = NULL; el->el_map.emacs = NULL; el->el_map.vic = NULL; el->el_map.vii = NULL; - free((ptr_t) el->el_map.help); + free(el->el_map.help); el->el_map.help = NULL; - free((ptr_t) el->el_map.func); + free(el->el_map.func); el->el_map.func = NULL; } diff --git a/lib/libedit/read.c b/lib/libedit/read.c index c152dca3696..aaa67eb8485 100644 --- a/lib/libedit/read.c +++ b/lib/libedit/read.c @@ -1,4 +1,4 @@ -/* $OpenBSD: read.c,v 1.18 2016/01/30 12:22:20 schwarze Exp $ */ +/* $OpenBSD: read.c,v 1.19 2016/01/30 17:32:52 schwarze Exp $ */ /* $NetBSD: read.c,v 1.57 2010/07/21 18:18:52 christos Exp $ */ /*- @@ -156,7 +156,7 @@ read__fixio(int fd __attribute__((__unused__)), int e) { int zero = 0; - if (ioctl(fd, FIONBIO, (ioctl_t) & zero) == -1) + if (ioctl(fd, FIONBIO, &zero) == -1) return -1; else e = 1; @@ -190,7 +190,7 @@ read_preread(EditLine *el) /* FIONREAD attempts to buffer up multiple bytes, and to make that work * properly with partial wide/UTF-8 characters would need some careful work. */ #ifdef FIONREAD - (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs); + (void) ioctl(el->el_infd, FIONREAD, &chrs); if (chrs > 0) { char buf[EL_BUFSIZ]; @@ -506,7 +506,7 @@ FUN(el,gets)(EditLine *el, int *nread) if (el->el_tty.t_mode == EX_IO && ma->level < 0) { long chrs = 0; - (void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs); + (void) ioctl(el->el_infd, FIONREAD, &chrs); if (chrs == 0) { if (tty_rawmode(el) < 0) { errno = 0; diff --git a/lib/libedit/search.c b/lib/libedit/search.c index 10a5c4cfa36..d1fead9e9aa 100644 --- a/lib/libedit/search.c +++ b/lib/libedit/search.c @@ -1,4 +1,4 @@ -/* $OpenBSD: search.c,v 1.15 2016/01/30 12:22:20 schwarze Exp $ */ +/* $OpenBSD: search.c,v 1.16 2016/01/30 17:32:52 schwarze Exp $ */ /* $NetBSD: search.c,v 1.24 2010/04/15 00:57:33 christos Exp $ */ /*- @@ -80,7 +80,7 @@ protected void search_end(EditLine *el) { - free((ptr_t) el->el_search.patbuf); + free(el->el_search.patbuf); el->el_search.patbuf = NULL; } @@ -131,7 +131,7 @@ el_match(const Char *str, const Char *pat) #elif defined(REGEXP) if ((re = regcomp(ct_encode_string(pat, &conv))) != NULL) { rv = regexec(re, ct_encode_string(str, &conv)); - free((ptr_t) re); + free(re); } else { rv = 0; } diff --git a/lib/libedit/sys.h b/lib/libedit/sys.h index b5a00249380..36cd00ce0ea 100644 --- a/lib/libedit/sys.h +++ b/lib/libedit/sys.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sys.h,v 1.10 2015/04/04 18:05:05 guenther Exp $ */ +/* $OpenBSD: sys.h,v 1.11 2016/01/30 17:32:52 schwarze Exp $ */ /* $NetBSD: sys.h,v 1.13 2009/12/30 22:37:40 christos Exp $ */ /*- @@ -76,16 +76,6 @@ # define __arraycount(a) (sizeof(a) / sizeof(*(a))) #endif -#ifndef _PTR_T -# define _PTR_T -typedef void *ptr_t; -#endif - -#ifndef _IOCTL_T -# define _IOCTL_T -typedef void *ioctl_t; -#endif - #include <stdio.h> #ifndef HAVE_STRLCAT @@ -115,40 +105,4 @@ extern char* tgoto(const char*, int, int); extern char* tgetstr(char*, char**); #endif -#ifdef notdef -# undef REGEX -# undef REGEXP -# include <malloc.h> -# ifdef __GNUC__ -/* - * Broken hdrs. - */ -extern int tgetent(const char *bp, char *name); -extern int tgetflag(const char *id); -extern int tgetnum(const char *id); -extern char *tgetstr(const char *id, char **area); -extern char *tgoto(const char *cap, int col, int row); -extern int tputs(const char *str, int affcnt, int (*putc)(int)); -extern char *getenv(const char *); -extern int fprintf(FILE *, const char *, ...); -extern int sigsetmask(int); -extern int sigblock(int); -extern int fputc(int, FILE *); -extern int fgetc(FILE *); -extern int fflush(FILE *); -extern int tolower(int); -extern int toupper(int); -extern int errno, sys_nerr; -extern char *sys_errlist[]; -extern void perror(const char *); -# include <string.h> -# define strerror(e) sys_errlist[e] -# endif -# ifdef SABER -extern ptr_t memcpy(ptr_t, const ptr_t, size_t); -extern ptr_t memset(ptr_t, int, size_t); -# endif -extern char *fgetline(FILE *, int *); -#endif - #endif /* _h_sys */ diff --git a/lib/libedit/terminal.c b/lib/libedit/terminal.c index 7890b8d8608..f1526f71817 100644 --- a/lib/libedit/terminal.c +++ b/lib/libedit/terminal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: terminal.c,v 1.5 2016/01/30 12:22:20 schwarze Exp $ */ +/* $OpenBSD: terminal.c,v 1.6 2016/01/30 17:32:52 schwarze Exp $ */ /* $NetBSD: term.c,v 1.57 2009/12/30 22:37:40 christos Exp $ */ /*- @@ -421,8 +421,8 @@ terminal_alloc_display(EditLine *el) b[i] = reallocarray(NULL, c->h + 1, sizeof(**b)); if (b[i] == NULL) { while (--i >= 0) - free((ptr_t) b[i]); - free((ptr_t) b); + free(b[i]); + free(b); goto done; } } @@ -436,8 +436,8 @@ terminal_alloc_display(EditLine *el) b[i] = reallocarray(NULL, c->h + 1, sizeof(**b)); if (b[i] == NULL) { while (--i >= 0) - free((ptr_t) b[i]); - free((ptr_t) b); + free(b[i]); + free(b); goto done; } } @@ -465,15 +465,15 @@ terminal_free_display(EditLine *el) el->el_display = NULL; if (b != NULL) { for (bufp = b; *bufp != NULL; bufp++) - free((ptr_t) *bufp); - free((ptr_t) b); + free(*bufp); + free(b); } b = el->el_vdisplay; el->el_vdisplay = NULL; if (b != NULL) { for (bufp = b; *bufp != NULL; bufp++) - free((ptr_t) *bufp); - free((ptr_t) b); + free(*bufp); + free(b); } } @@ -955,7 +955,7 @@ terminal_get_size(EditLine *el, int *lins, int *cols) #ifdef TIOCGWINSZ { struct winsize ws; - if (ioctl(el->el_infd, TIOCGWINSZ, (ioctl_t) & ws) != -1) { + if (ioctl(el->el_infd, TIOCGWINSZ, &ws) != -1) { if (ws.ws_col) *cols = ws.ws_col; if (ws.ws_row) @@ -966,7 +966,7 @@ terminal_get_size(EditLine *el, int *lins, int *cols) #ifdef TIOCGSIZE { struct ttysize ts; - if (ioctl(el->el_infd, TIOCGSIZE, (ioctl_t) & ts) != -1) { + if (ioctl(el->el_infd, TIOCGSIZE, &ts) != -1) { if (ts.ts_cols) *cols = ts.ts_cols; if (ts.ts_lines) diff --git a/lib/libedit/tokenizer.c b/lib/libedit/tokenizer.c index 7af433a38c0..a2356101247 100644 --- a/lib/libedit/tokenizer.c +++ b/lib/libedit/tokenizer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tokenizer.c,v 1.14 2016/01/30 12:22:20 schwarze Exp $ */ +/* $OpenBSD: tokenizer.c,v 1.15 2016/01/30 17:32:52 schwarze Exp $ */ /* $NetBSD: tokenizer.c,v 1.18 2010/01/03 18:27:10 christos Exp $ */ /*- @@ -103,23 +103,23 @@ FUN(tok,init)(const Char *ifs) return NULL; tok->ifs = tok_strdup(ifs ? ifs : IFS); if (tok->ifs == NULL) { - free((ptr_t)tok); + free(tok); return NULL; } tok->argc = 0; tok->amax = AINCR; tok->argv = reallocarray(NULL, tok->amax, sizeof(*tok->argv)); if (tok->argv == NULL) { - free((ptr_t)tok->ifs); - free((ptr_t)tok); + free(tok->ifs); + free(tok); return NULL; } tok->argv[0] = NULL; tok->wspace = reallocarray(NULL, WINCR, sizeof(*tok->wspace)); if (tok->wspace == NULL) { - free((ptr_t)tok->argv); - free((ptr_t)tok->ifs); - free((ptr_t)tok); + free(tok->argv); + free(tok->ifs); + free(tok); return NULL; } tok->wmax = tok->wspace + WINCR; @@ -154,10 +154,10 @@ public void FUN(tok,end)(TYPE(Tokenizer) *tok) { - free((ptr_t) tok->ifs); - free((ptr_t) tok->wspace); - free((ptr_t) tok->argv); - free((ptr_t) tok); + free(tok->ifs); + free(tok->wspace); + free(tok->argv); + free(tok); } diff --git a/lib/libedit/vi.c b/lib/libedit/vi.c index 17bff3ed853..78474c29372 100644 --- a/lib/libedit/vi.c +++ b/lib/libedit/vi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vi.c,v 1.14 2016/01/30 12:22:20 schwarze Exp $ */ +/* $OpenBSD: vi.c,v 1.15 2016/01/30 17:32:52 schwarze Exp $ */ /* $NetBSD: vi.c,v 1.33 2011/02/17 16:44:48 joerg Exp $ */ /*- @@ -1023,7 +1023,7 @@ vi_histedit(EditLine *el, Int c) if (line == NULL) { close(fd); unlink(tempfile); - free((ptr_t)cp); + free(cp); return CC_ERROR; } Strncpy(line, el->el_line.buffer, len); |