diff options
author | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2016-03-20 22:58:00 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@cvs.openbsd.org> | 2016-03-20 22:58:00 +0000 |
commit | 9621f647cee71d37109886077ad0c87c3701b2a2 (patch) | |
tree | 617603aa22e5da79f07eb6d9fdf0c98a577b8745 | |
parent | 6aeeb948f407af0fb507bee333795cec095d00f3 (diff) |
Cleanup of private header inclusion:
1. Do not include private headers from "chared.h", "hist.h", "prompt.h",
"refresh.h", "search.h", "sig.h", "terminal.h", "tty.h".
The only private header having to include other private headers is "el.h".
2. Do not include "common.h", "parse.h", "help.h" from "el.h",
and do not include "emacs.h" and "vi.h" from "chared.h",
include them directly where needed.
3. Do include "fcns.h" from "el.h" because el_func_t is needed for "map.h".
4. Do not include private headers again that are already included by "el.h".
5. Include private headers after standard headers.
OK czarkoff@
-rw-r--r-- | lib/libedit/chared.c | 4 | ||||
-rw-r--r-- | lib/libedit/chared.h | 10 | ||||
-rw-r--r-- | lib/libedit/common.c | 5 | ||||
-rw-r--r-- | lib/libedit/el.c | 3 | ||||
-rw-r--r-- | lib/libedit/el.h | 6 | ||||
-rw-r--r-- | lib/libedit/eln.c | 7 | ||||
-rw-r--r-- | lib/libedit/emacs.c | 5 | ||||
-rw-r--r-- | lib/libedit/filecomplete.c | 4 | ||||
-rw-r--r-- | lib/libedit/hist.h | 6 | ||||
-rw-r--r-- | lib/libedit/makelist | 5 | ||||
-rw-r--r-- | lib/libedit/map.c | 5 | ||||
-rw-r--r-- | lib/libedit/parse.c | 6 | ||||
-rw-r--r-- | lib/libedit/prompt.h | 6 | ||||
-rw-r--r-- | lib/libedit/readline.c | 6 | ||||
-rw-r--r-- | lib/libedit/refresh.h | 6 | ||||
-rw-r--r-- | lib/libedit/search.c | 6 | ||||
-rw-r--r-- | lib/libedit/search.h | 6 | ||||
-rw-r--r-- | lib/libedit/sig.c | 8 | ||||
-rw-r--r-- | lib/libedit/sig.h | 6 | ||||
-rw-r--r-- | lib/libedit/terminal.h | 4 | ||||
-rw-r--r-- | lib/libedit/tty.c | 5 | ||||
-rw-r--r-- | lib/libedit/tty.h | 4 | ||||
-rw-r--r-- | lib/libedit/vi.c | 5 |
23 files changed, 61 insertions, 67 deletions
diff --git a/lib/libedit/chared.c b/lib/libedit/chared.c index c4fdb64eae9..120c5129c34 100644 --- a/lib/libedit/chared.c +++ b/lib/libedit/chared.c @@ -1,4 +1,4 @@ -/* $OpenBSD: chared.c,v 1.18 2016/03/20 20:35:38 schwarze Exp $ */ +/* $OpenBSD: chared.c,v 1.19 2016/03/20 22:57:59 schwarze Exp $ */ /* $NetBSD: chared.c,v 1.28 2009/12/30 22:37:40 christos Exp $ */ /*- @@ -39,7 +39,9 @@ * chared.c: Character editor utilities */ #include <stdlib.h> + #include "el.h" +#include "common.h" private void ch__clearmacro (EditLine *); diff --git a/lib/libedit/chared.h b/lib/libedit/chared.h index 1913ab55310..e8cf3dea6d1 100644 --- a/lib/libedit/chared.h +++ b/lib/libedit/chared.h @@ -1,4 +1,4 @@ -/* $OpenBSD: chared.h,v 1.11 2016/03/20 20:35:38 schwarze Exp $ */ +/* $OpenBSD: chared.h,v 1.12 2016/03/20 22:57:59 schwarze Exp $ */ /* $NetBSD: chared.h,v 1.20 2010/04/15 00:57:33 christos Exp $ */ /*- @@ -44,8 +44,6 @@ #include <ctype.h> #include <string.h> -#include "histedit.h" - #define EL_MAXMACRO 10 /* @@ -137,12 +135,6 @@ typedef struct el_chared_t { #define MODE_REPLACE 1 #define MODE_REPLACE_1 2 -#include "common.h" -#include "vi.h" -#include "emacs.h" -#include "search.h" -#include "fcns.h" - protected int cv__isword(wint_t); protected int cv__isWord(wint_t); diff --git a/lib/libedit/common.c b/lib/libedit/common.c index ca18f829872..c7344183717 100644 --- a/lib/libedit/common.c +++ b/lib/libedit/common.c @@ -1,4 +1,4 @@ -/* $OpenBSD: common.c,v 1.11 2016/03/20 20:35:38 schwarze Exp $ */ +/* $OpenBSD: common.c,v 1.12 2016/03/20 22:57:59 schwarze Exp $ */ /* $NetBSD: common.c,v 1.24 2009/12/30 22:37:40 christos Exp $ */ /*- @@ -39,6 +39,9 @@ * common.c: Common Editor functions */ #include "el.h" +#include "common.h" +#include "parse.h" +#include "vi.h" /* ed_end_of_file(): * Indicate end of file diff --git a/lib/libedit/el.c b/lib/libedit/el.c index a304399b080..68b56dbd264 100644 --- a/lib/libedit/el.c +++ b/lib/libedit/el.c @@ -1,4 +1,4 @@ -/* $OpenBSD: el.c,v 1.26 2016/03/20 22:09:24 schwarze Exp $ */ +/* $OpenBSD: el.c,v 1.27 2016/03/20 22:57:59 schwarze Exp $ */ /* $NetBSD: el.c,v 1.61 2011/01/27 23:11:40 christos Exp $ */ /*- @@ -50,6 +50,7 @@ #endif #include "el.h" +#include "parse.h" /* el_init(): * Initialize editline and set default parameters. diff --git a/lib/libedit/el.h b/lib/libedit/el.h index 3dd5eb38276..37bf3f72e4f 100644 --- a/lib/libedit/el.h +++ b/lib/libedit/el.h @@ -1,4 +1,4 @@ -/* $OpenBSD: el.h,v 1.13 2016/03/20 19:33:16 schwarze Exp $ */ +/* $OpenBSD: el.h,v 1.14 2016/03/20 22:57:59 schwarze Exp $ */ /* $NetBSD: el.h,v 1.21 2009/12/31 15:58:26 christos Exp $ */ /*- @@ -97,13 +97,11 @@ typedef struct el_state_t { #include "terminal.h" #include "refresh.h" #include "chared.h" -#include "common.h" #include "search.h" #include "hist.h" +#include "fcns.h" /* el_func_t is needed for map.h */ #include "map.h" -#include "parse.h" #include "sig.h" -#include "help.h" #include "read.h" struct editline { diff --git a/lib/libedit/eln.c b/lib/libedit/eln.c index 3395b239720..109c682d866 100644 --- a/lib/libedit/eln.c +++ b/lib/libedit/eln.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eln.c,v 1.8 2016/03/20 19:33:16 schwarze Exp $ */ +/* $OpenBSD: eln.c,v 1.9 2016/03/20 22:57:59 schwarze Exp $ */ /* $NetBSD: eln.c,v 1.9 2010/11/04 13:53:12 christos Exp $ */ /*- @@ -35,14 +35,13 @@ */ #include "config.h" -#include "histedit.h" -#include "el.h" -#include "read.h" #include <errno.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> +#include "el.h" + public int el_getc(EditLine *el, char *cp) { diff --git a/lib/libedit/emacs.c b/lib/libedit/emacs.c index 098041738c9..66972a6c3b6 100644 --- a/lib/libedit/emacs.c +++ b/lib/libedit/emacs.c @@ -1,5 +1,5 @@ -/* $OpenBSD: emacs.c,v 1.12 2016/03/20 20:35:38 schwarze Exp $ */ -/* $NetBSD: emacs.c,v 1.25 2011/07/29 15:16:33 christos Exp $ */ +/* $OpenBSD: emacs.c,v 1.13 2016/03/20 22:57:59 schwarze Exp $ */ +/* $NetBSD: emacs.c,v 1.31 2016/02/16 19:08:41 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -39,6 +39,7 @@ * emacs.c: Emacs functions */ #include "el.h" +#include "emacs.h" /* em_delete_or_list(): * Delete character under cursor or list completions if at end of line diff --git a/lib/libedit/filecomplete.c b/lib/libedit/filecomplete.c index f5da3357fe7..68b99ae2496 100644 --- a/lib/libedit/filecomplete.c +++ b/lib/libedit/filecomplete.c @@ -1,4 +1,4 @@ -/* $OpenBSD: filecomplete.c,v 1.7 2016/01/31 15:34:53 schwarze Exp $ */ +/* $OpenBSD: filecomplete.c,v 1.8 2016/03/20 22:57:59 schwarze Exp $ */ /* $NetBSD: filecomplete.c,v 1.22 2010/12/02 04:42:46 dholland Exp $ */ /*- @@ -46,8 +46,6 @@ #include <fcntl.h> #include "el.h" -#include "fcns.h" /* for EL_NUM_FCNS */ -#include "histedit.h" #include "filecomplete.h" static const Char break_chars[] = { ' ', '\t', '\n', '"', '\\', '\'', '`', '@', diff --git a/lib/libedit/hist.h b/lib/libedit/hist.h index ebc4982c607..5065743d86e 100644 --- a/lib/libedit/hist.h +++ b/lib/libedit/hist.h @@ -1,5 +1,5 @@ -/* $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 $ */ +/* $OpenBSD: hist.h,v 1.11 2016/03/20 22:57:59 schwarze Exp $ */ +/* $NetBSD: hist.h,v 1.17 2016/02/16 15:53:48 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -41,8 +41,6 @@ #ifndef _h_el_hist #define _h_el_hist -#include "histedit.h" - typedef int (*hist_fun_t)(void *, TYPE(HistEvent) *, int, ...); typedef struct el_history_t { diff --git a/lib/libedit/makelist b/lib/libedit/makelist index 9ca44e592c5..872f38e8fe3 100644 --- a/lib/libedit/makelist +++ b/lib/libedit/makelist @@ -93,7 +93,7 @@ _EOF BEGIN { printf("/* Automatically generated file, do not edit */\n"); printf("#include \"config.h\"\n#include \"el.h\"\n"); - printf("#include \"chartype.h\"\n"); + printf("#include \"help.h\"\n"); printf("private const struct el_bindings_t el_func_help[] = {\n"); low = "abcdefghijklmnopqrstuvwxyz_"; high = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_"; @@ -175,6 +175,9 @@ _EOF BEGIN { printf("/* Automatically generated file, do not edit */\n"); printf("#include \"config.h\"\n#include \"el.h\"\n"); + printf("#include \"common.h\"\n"); + printf("#include \"emacs.h\"\n"); + printf("#include \"vi.h\"\n"); printf("private const el_func_t el_func[] = {"); maxlen = 80; needn = 1; diff --git a/lib/libedit/map.c b/lib/libedit/map.c index 4ef0879c4f4..71c50f71fa7 100644 --- a/lib/libedit/map.c +++ b/lib/libedit/map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: map.c,v 1.17 2016/03/20 20:35:38 schwarze Exp $ */ +/* $OpenBSD: map.c,v 1.18 2016/03/20 22:57:59 schwarze Exp $ */ /* $NetBSD: map.c,v 1.25 2009/12/30 22:37:40 christos Exp $ */ /*- @@ -39,7 +39,10 @@ * map.c: Editor function definitions */ #include <stdlib.h> + #include "el.h" +#include "help.h" +#include "parse.h" private void map_print_key(EditLine *, el_action_t *, const Char *); private void map_print_some_keys(EditLine *, el_action_t *, wint_t, wint_t); diff --git a/lib/libedit/parse.c b/lib/libedit/parse.c index 1ada67c92ca..75f352e3d3e 100644 --- a/lib/libedit/parse.c +++ b/lib/libedit/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.15 2016/03/20 20:35:38 schwarze Exp $ */ +/* $OpenBSD: parse.c,v 1.16 2016/03/20 22:57:59 schwarze Exp $ */ /* $NetBSD: parse.c,v 1.23 2009/12/30 22:37:40 christos Exp $ */ /*- @@ -48,9 +48,11 @@ * settc * setty */ -#include "el.h" #include <stdlib.h> +#include "el.h" +#include "parse.h" + private const struct { const Char *name; int (*func)(EditLine *, int, const Char **); diff --git a/lib/libedit/prompt.h b/lib/libedit/prompt.h index e0a22035031..92043e05dc1 100644 --- a/lib/libedit/prompt.h +++ b/lib/libedit/prompt.h @@ -1,5 +1,5 @@ -/* $OpenBSD: prompt.h,v 1.7 2010/06/30 00:05:35 nicm Exp $ */ -/* $NetBSD: prompt.h,v 1.10 2009/12/30 22:37:40 christos Exp $ */ +/* $OpenBSD: prompt.h,v 1.8 2016/03/20 22:57:59 schwarze Exp $ */ +/* $NetBSD: prompt.h,v 1.12 2016/02/16 15:53:48 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -41,8 +41,6 @@ #ifndef _h_el_prompt #define _h_el_prompt -#include "histedit.h" - typedef Char *(*el_pfunc_t)(EditLine *); typedef struct el_prompt_t { diff --git a/lib/libedit/readline.c b/lib/libedit/readline.c index 2e37070033f..fbb74e17fec 100644 --- a/lib/libedit/readline.c +++ b/lib/libedit/readline.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readline.c,v 1.16 2016/03/20 00:01:21 krw Exp $ */ +/* $OpenBSD: readline.c,v 1.17 2016/03/20 22:57:59 schwarze Exp $ */ /* $NetBSD: readline.c,v 1.91 2010/08/28 15:44:59 christos Exp $ */ /*- @@ -53,8 +53,6 @@ #endif #include "readline/readline.h" #include "el.h" -#include "fcns.h" /* for EL_NUM_FCNS */ -#include "histedit.h" #include "filecomplete.h" void rl_prep_terminal(int); @@ -2248,7 +2246,7 @@ rl_on_new_line(void) int /*ARGSUSED*/ -rl_set_keyboard_input_timeout(int u) +rl_set_keyboard_input_timeout(int u __attribute__((__unused__))) { return 0; } diff --git a/lib/libedit/refresh.h b/lib/libedit/refresh.h index c91f7ff4d78..e136426ae7e 100644 --- a/lib/libedit/refresh.h +++ b/lib/libedit/refresh.h @@ -1,5 +1,5 @@ -/* $OpenBSD: refresh.h,v 1.8 2016/03/20 20:35:38 schwarze Exp $ */ -/* $NetBSD: refresh.h,v 1.6 2009/12/30 22:37:40 christos Exp $ */ +/* $OpenBSD: refresh.h,v 1.9 2016/03/20 22:57:59 schwarze Exp $ */ +/* $NetBSD: refresh.h,v 1.9 2016/02/16 15:53:48 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -41,8 +41,6 @@ #ifndef _h_el_refresh #define _h_el_refresh -#include "histedit.h" - typedef struct { coord_t r_cursor; /* Refresh cursor position */ int r_oldcv; /* Vertical locations */ diff --git a/lib/libedit/search.c b/lib/libedit/search.c index 067346db361..1316dd6ae2c 100644 --- a/lib/libedit/search.c +++ b/lib/libedit/search.c @@ -1,5 +1,5 @@ -/* $OpenBSD: search.c,v 1.17 2016/03/20 20:35:38 schwarze Exp $ */ -/* $NetBSD: search.c,v 1.24 2010/04/15 00:57:33 christos Exp $ */ +/* $OpenBSD: search.c,v 1.18 2016/03/20 22:57:59 schwarze Exp $ */ +/* $NetBSD: search.c,v 1.37 2016/02/16 19:08:41 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -44,7 +44,9 @@ #elif defined(REGEXP) #include <regexp.h> #endif + #include "el.h" +#include "common.h" /* * Adjust cursor in vi mode to include the character under it diff --git a/lib/libedit/search.h b/lib/libedit/search.h index c2e719c8b47..64616a7ad54 100644 --- a/lib/libedit/search.h +++ b/lib/libedit/search.h @@ -1,5 +1,5 @@ -/* $OpenBSD: search.h,v 1.9 2016/03/20 20:35:38 schwarze Exp $ */ -/* $NetBSD: search.h,v 1.9 2009/12/30 22:37:40 christos Exp $ */ +/* $OpenBSD: search.h,v 1.10 2016/03/20 22:57:59 schwarze Exp $ */ +/* $NetBSD: search.h,v 1.12 2016/02/16 15:53:48 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -41,8 +41,6 @@ #ifndef _h_el_search #define _h_el_search -#include "histedit.h" - typedef struct el_search_t { Char *patbuf; /* The pattern buffer */ size_t patlen; /* Length of the pattern buffer */ diff --git a/lib/libedit/sig.c b/lib/libedit/sig.c index 4185f7657fd..fd925ac6351 100644 --- a/lib/libedit/sig.c +++ b/lib/libedit/sig.c @@ -1,5 +1,5 @@ -/* $OpenBSD: sig.c,v 1.16 2016/03/20 21:25:27 schwarze Exp $ */ -/* $NetBSD: sig.c,v 1.18 2016/02/15 15:29:25 christos Exp $ */ +/* $OpenBSD: sig.c,v 1.17 2016/03/20 22:57:59 schwarze Exp $ */ +/* $NetBSD: sig.c,v 1.24 2016/02/16 19:08:41 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -40,9 +40,11 @@ * our policy is to trap all signals, set a good state * and pass the ball to our caller. */ -#include "el.h" #include <stdlib.h> +#include "el.h" +#include "common.h" + private EditLine *sel = NULL; private const int sighdl[] = { diff --git a/lib/libedit/sig.h b/lib/libedit/sig.h index ac1b1b917be..227315871b9 100644 --- a/lib/libedit/sig.h +++ b/lib/libedit/sig.h @@ -1,5 +1,5 @@ -/* $OpenBSD: sig.h,v 1.7 2010/06/30 00:05:35 nicm Exp $ */ -/* $NetBSD: sig.h,v 1.8 2009/02/19 15:20:22 christos Exp $ */ +/* $OpenBSD: sig.h,v 1.8 2016/03/20 22:57:59 schwarze Exp $ */ +/* $NetBSD: sig.h,v 1.10 2016/02/16 15:53:48 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -43,8 +43,6 @@ #include <signal.h> -#include "histedit.h" - /* * Define here all the signals we are going to handle * The _DO macro is used to iterate in the source code diff --git a/lib/libedit/terminal.h b/lib/libedit/terminal.h index 8836d0a5822..23fbe059667 100644 --- a/lib/libedit/terminal.h +++ b/lib/libedit/terminal.h @@ -1,4 +1,4 @@ -/* $OpenBSD: terminal.h,v 1.4 2016/03/20 20:35:38 schwarze Exp $ */ +/* $OpenBSD: terminal.h,v 1.5 2016/03/20 22:57:59 schwarze Exp $ */ /* $NetBSD: term.h,v 1.21 2009/12/30 22:37:40 christos Exp $ */ /*- @@ -41,8 +41,6 @@ #ifndef _h_el_terminal #define _h_el_terminal -#include "histedit.h" - typedef struct { /* Symbolic function key bindings */ const Char *name; /* name of the key */ int key; /* Index in termcap table */ diff --git a/lib/libedit/tty.c b/lib/libedit/tty.c index 3a9ce30e7f2..97e338c04c7 100644 --- a/lib/libedit/tty.c +++ b/lib/libedit/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.19 2016/03/20 20:35:38 schwarze Exp $ */ +/* $OpenBSD: tty.c,v 1.20 2016/03/20 22:57:59 schwarze Exp $ */ /* $NetBSD: tty.c,v 1.34 2011/01/27 23:11:40 christos Exp $ */ /*- @@ -42,8 +42,9 @@ #include <errno.h> #include <unistd.h> /* for isatty */ #include <strings.h> /* for ffs */ + #include "el.h" -#include "tty.h" +#include "parse.h" typedef struct ttymodes_t { const char *m_name; diff --git a/lib/libedit/tty.h b/lib/libedit/tty.h index cb531a646c2..49a7541942a 100644 --- a/lib/libedit/tty.h +++ b/lib/libedit/tty.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.h,v 1.9 2014/05/20 22:28:07 yasuoka Exp $ */ +/* $OpenBSD: tty.h,v 1.10 2016/03/20 22:57:59 schwarze Exp $ */ /* $NetBSD: tty.h,v 1.12 2009/12/30 22:37:40 christos Exp $ */ /*- @@ -41,8 +41,6 @@ #ifndef _h_el_tty #define _h_el_tty -#include "sys.h" -#include "histedit.h" #include <termios.h> #include <unistd.h> diff --git a/lib/libedit/vi.c b/lib/libedit/vi.c index 3b422ef4524..aed99136334 100644 --- a/lib/libedit/vi.c +++ b/lib/libedit/vi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vi.c,v 1.16 2016/03/20 20:35:38 schwarze Exp $ */ +/* $OpenBSD: vi.c,v 1.17 2016/03/20 22:57:59 schwarze Exp $ */ /* $NetBSD: vi.c,v 1.33 2011/02/17 16:44:48 joerg Exp $ */ /*- @@ -43,6 +43,9 @@ * vi.c: Vi mode commands. */ #include "el.h" +#include "common.h" +#include "emacs.h" +#include "vi.h" private el_action_t cv_action(EditLine *, wint_t); private el_action_t cv_paste(EditLine *, wint_t); |