aboutsummaryrefslogtreecommitdiff
path: root/src/digraph.c
diff options
context:
space:
mode:
authorscott-linder <scott.b.linder@wmich.edu>2014-02-23 15:34:45 -0500
committerscott-linder <scott.b.linder@wmich.edu>2014-02-24 09:48:18 -0500
commitb76c358f3de9106a4bdbf853b4c4371f6f7a62c2 (patch)
treefef0339611c6e76afc3dc8da4b6bd2ab227e3066 /src/digraph.c
parent1bcbc42330d651f06b8a842e16fe36475afde05d (diff)
downloadrneovim-b76c358f3de9106a4bdbf853b4c4371f6f7a62c2.tar.gz
rneovim-b76c358f3de9106a4bdbf853b4c4371f6f7a62c2.tar.bz2
rneovim-b76c358f3de9106a4bdbf853b4c4371f6f7a62c2.zip
Convert function declarations from K&R to ANSI style.
cproto (http://invisible-island.net/cproto/) was used to do the bulk of the work in batch; even the most recent version had some issues with typedef'd parameters; a quick "patch" was to modify `lex.l` to explicitly include all vim typedefs as known types. One example from `vim.h` is typedef unsigned char char_u; which was added in `lex.l` as <INITIAL>char_u { save_text_offset(); return T_CHAR; } Even with these changes there were some problems: * Two files (`mbyte.c` and `os_unix.c`) were not cleanly converted. * Any function with the `UNUSED` macro in its parameter list was not converted. Rather than spend more time fixing the automated approach, the two files `mbyte.c` and `os_unix.c` were converted by hand. The `UNUSED` macros were compiler specific, and the alternative, generic version would require a different syntax, so in order to simplify the conversion all uses of `UNUSED` were stripped, and then the sources were run back through cproto. It is planned to reconsider each use of `UNUSED` manually using a new macro definition.
Diffstat (limited to 'src/digraph.c')
-rw-r--r--src/digraph.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/src/digraph.c b/src/digraph.c
index 4584973526..4a1e1e4d04 100644
--- a/src/digraph.c
+++ b/src/digraph.c
@@ -1623,8 +1623,7 @@ static digr_T digraphdefault[] =
/*
* handle digraphs after typing a character
*/
-int do_digraph(c)
-int c;
+int do_digraph(int c)
{
static int backspaced; /* character before K_BS */
static int lastchar; /* last typed character */
@@ -1647,8 +1646,10 @@ int c;
* mode.
* Returns composed character, or NUL when ESC was used.
*/
-int get_digraph(cmdline)
-int cmdline; /* TRUE when called from the cmdline */
+int
+get_digraph (
+ int cmdline /* TRUE when called from the cmdline */
+)
{
int c, cc;
@@ -1683,10 +1684,7 @@ int cmdline; /* TRUE when called from the cmdline */
* If no match, return "char2".
* If "meta_char" is TRUE and "char1" is a space, return "char2" | 0x80.
*/
-static int getexactdigraph(char1, char2, meta_char)
-int char1;
-int char2;
-int meta_char;
+static int getexactdigraph(int char1, int char2, int meta_char)
{
int i;
int retval = 0;
@@ -1759,10 +1757,7 @@ int meta_char;
* Get digraph.
* Allow for both char1-char2 and char2-char1
*/
-int getdigraph(char1, char2, meta_char)
-int char1;
-int char2;
-int meta_char;
+int getdigraph(int char1, int char2, int meta_char)
{
int retval;
@@ -1777,8 +1772,7 @@ int meta_char;
* Add the digraphs in the argument to the digraph table.
* format: {c1}{c2} char {c1}{c2} char ...
*/
-void putdigraph(str)
-char_u *str;
+void putdigraph(char_u *str)
{
int char1, char2, n;
int i;
@@ -1828,7 +1822,7 @@ char_u *str;
}
}
-void listdigraphs() {
+void listdigraphs(void) {
int i;
digr_T *dp;
@@ -1867,8 +1861,7 @@ void listdigraphs() {
wrong, in which case we messed up ScreenLines */
}
-static void printdigraph(dp)
-digr_T *dp;
+static void printdigraph(digr_T *dp)
{
char_u buf[30];
char_u *p;
@@ -1925,7 +1918,7 @@ static void keymap_unload __ARGS((void));
* used when setting the option, not later when the value has already been
* checked.
*/
-char_u * keymap_init() {
+char_u *keymap_init(void) {
curbuf->b_kmap_state &= ~KEYMAP_INIT;
if (*curbuf->b_p_keymap == NUL) {
@@ -1967,8 +1960,7 @@ char_u * keymap_init() {
/*
* ":loadkeymap" command: load the following lines as the keymap.
*/
-void ex_loadkeymap(eap)
-exarg_T *eap;
+void ex_loadkeymap(exarg_T *eap)
{
char_u *line;
char_u *p;
@@ -2044,7 +2036,7 @@ exarg_T *eap;
/*
* Stop using 'keymap'.
*/
-static void keymap_unload() {
+static void keymap_unload(void) {
char_u buf[KMAP_MAXLEN + 10];
int i;
char_u *save_cpo = p_cpo;