diff --git a/src/fold.c b/src/fold.c
index dcf96b9..e0b2609 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -100,9 +100,7 @@
  * Copy that folding state from window "wp_from" to window "wp_to".
  */
     void
-copyFoldingState(wp_from, wp_to)
-    win_T	*wp_from;
-    win_T	*wp_to;
+copyFoldingState(win_T *wp_from, win_T *wp_to)
 {
     wp_to->w_fold_manual = wp_from->w_fold_manual;
     wp_to->w_foldinvalid = wp_from->w_foldinvalid;
@@ -115,8 +113,7 @@
  * Return TRUE if there may be folded lines in the current window.
  */
     int
-hasAnyFolding(win)
-    win_T	*win;
+hasAnyFolding(win_T *win)
 {
     /* very simple now, but can become more complex later */
     return (win->w_p_fen
@@ -131,23 +128,20 @@
  * lnum of the sequence of folded lines (skipped when NULL).
  */
     int
-hasFolding(lnum, firstp, lastp)
-    linenr_T	lnum;
-    linenr_T	*firstp;
-    linenr_T	*lastp;
+hasFolding(linenr_T lnum, linenr_T *firstp, linenr_T *lastp)
 {
     return hasFoldingWin(curwin, lnum, firstp, lastp, TRUE, NULL);
 }
 
 /* hasFoldingWin() {{{2 */
     int
-hasFoldingWin(win, lnum, firstp, lastp, cache, infop)
-    win_T	*win;
-    linenr_T	lnum;
-    linenr_T	*firstp;
-    linenr_T	*lastp;
-    int		cache;		/* when TRUE: use cached values of window */
-    foldinfo_T	*infop;		/* where to store fold info */
+hasFoldingWin(
+    win_T	*win,
+    linenr_T	lnum,
+    linenr_T	*firstp,
+    linenr_T	*lastp,
+    int		cache,		/* when TRUE: use cached values of window */
+    foldinfo_T	*infop)		/* where to store fold info */
 {
     int		had_folded = FALSE;
     linenr_T	first = 0;
@@ -254,8 +248,7 @@
  * Return fold level at line number "lnum" in the current window.
  */
     int
-foldLevel(lnum)
-    linenr_T	lnum;
+foldLevel(linenr_T lnum)
 {
     /* While updating the folds lines between invalid_top and invalid_bot have
      * an undefined fold level.  Otherwise update the folds first. */
@@ -281,9 +274,7 @@
  * Return MAYBE if the line is folded when next to a folded line.
  */
     int
-lineFolded(win, lnum)
-    win_T	*win;
-    linenr_T	lnum;
+lineFolded(win_T *win, linenr_T lnum)
 {
     return foldedCount(win, lnum, NULL) != 0;
 }
@@ -298,10 +289,7 @@
  * When "infop" is not NULL, fills *infop with the fold level info.
  */
     long
-foldedCount(win, lnum, infop)
-    win_T	*win;
-    linenr_T	lnum;
-    foldinfo_T	*infop;
+foldedCount(win_T *win, linenr_T lnum, foldinfo_T *infop)
 {
     linenr_T	last;
 
@@ -315,8 +303,7 @@
  * Return TRUE if 'foldmethod' is "manual"
  */
     int
-foldmethodIsManual(wp)
-    win_T	*wp;
+foldmethodIsManual(win_T *wp)
 {
     return (wp->w_p_fdm[3] == 'u');
 }
@@ -326,8 +313,7 @@
  * Return TRUE if 'foldmethod' is "indent"
  */
     int
-foldmethodIsIndent(wp)
-    win_T	*wp;
+foldmethodIsIndent(win_T *wp)
 {
     return (wp->w_p_fdm[0] == 'i');
 }
@@ -337,8 +323,7 @@
  * Return TRUE if 'foldmethod' is "expr"
  */
     int
-foldmethodIsExpr(wp)
-    win_T	*wp;
+foldmethodIsExpr(win_T *wp)
 {
     return (wp->w_p_fdm[1] == 'x');
 }
@@ -348,8 +333,7 @@
  * Return TRUE if 'foldmethod' is "marker"
  */
     int
-foldmethodIsMarker(wp)
-    win_T	*wp;
+foldmethodIsMarker(win_T *wp)
 {
     return (wp->w_p_fdm[2] == 'r');
 }
@@ -359,8 +343,7 @@
  * Return TRUE if 'foldmethod' is "syntax"
  */
     int
-foldmethodIsSyntax(wp)
-    win_T	*wp;
+foldmethodIsSyntax(win_T *wp)
 {
     return (wp->w_p_fdm[0] == 's');
 }
@@ -370,8 +353,7 @@
  * Return TRUE if 'foldmethod' is "diff"
  */
     int
-foldmethodIsDiff(wp)
-    win_T	*wp;
+foldmethodIsDiff(win_T *wp)
 {
     return (wp->w_p_fdm[0] == 'd');
 }
@@ -382,9 +364,7 @@
  * Repeat "count" times.
  */
     void
-closeFold(lnum, count)
-    linenr_T	lnum;
-    long	count;
+closeFold(linenr_T lnum, long count)
 {
     setFoldRepeat(lnum, count, FALSE);
 }
@@ -394,8 +374,7 @@
  * Close fold for current window at line "lnum" recursively.
  */
     void
-closeFoldRecurse(lnum)
-    linenr_T	lnum;
+closeFoldRecurse(linenr_T lnum)
 {
     (void)setManualFold(lnum, FALSE, TRUE, NULL);
 }
@@ -406,12 +385,12 @@
  * Used for "zo", "zO", "zc" and "zC" in Visual mode.
  */
     void
-opFoldRange(first, last, opening, recurse, had_visual)
-    linenr_T	first;
-    linenr_T	last;
-    int		opening;	/* TRUE to open, FALSE to close */
-    int		recurse;	/* TRUE to do it recursively */
-    int		had_visual;	/* TRUE when Visual selection used */
+opFoldRange(
+    linenr_T	first,
+    linenr_T	last,
+    int		opening,	/* TRUE to open, FALSE to close */
+    int		recurse,	/* TRUE to do it recursively */
+    int		had_visual)	/* TRUE when Visual selection used */
 {
     int		done = DONE_NOTHING;	/* avoid error messages */
     linenr_T	lnum;
@@ -443,9 +422,7 @@
  * Repeat "count" times.
  */
     void
-openFold(lnum, count)
-    linenr_T	lnum;
-    long	count;
+openFold(linenr_T lnum, long count)
 {
     setFoldRepeat(lnum, count, TRUE);
 }
@@ -455,8 +432,7 @@
  * Open fold for current window at line "lnum" recursively.
  */
     void
-openFoldRecurse(lnum)
-    linenr_T	lnum;
+openFoldRecurse(linenr_T lnum)
 {
     (void)setManualFold(lnum, TRUE, TRUE, NULL);
 }
@@ -466,7 +442,7 @@
  * Open folds until the cursor line is not in a closed fold.
  */
     void
-foldOpenCursor()
+foldOpenCursor(void)
 {
     int		done;
 
@@ -486,7 +462,7 @@
  * Set new foldlevel for current window.
  */
     void
-newFoldLevel()
+newFoldLevel(void)
 {
     newFoldLevelWin(curwin);
 
@@ -511,8 +487,7 @@
 }
 
     static void
-newFoldLevelWin(wp)
-    win_T	*wp;
+newFoldLevelWin(win_T *wp)
 {
     fold_T	*fp;
     int		i;
@@ -536,7 +511,7 @@
  * Apply 'foldlevel' to all folds that don't contain the cursor.
  */
     void
-foldCheckClose()
+foldCheckClose(void)
 {
     if (*p_fcl != NUL)	/* can only be "all" right now */
     {
@@ -549,10 +524,7 @@
 
 /* checkCloseRec() {{{2 */
     static int
-checkCloseRec(gap, lnum, level)
-    garray_T	*gap;
-    linenr_T	lnum;
-    int		level;
+checkCloseRec(garray_T *gap, linenr_T lnum, int level)
 {
     fold_T	*fp;
     int		retval = FALSE;
@@ -584,8 +556,7 @@
  * Give an error message and return FALSE if not.
  */
     int
-foldManualAllowed(create)
-    int		create;
+foldManualAllowed(int create)
 {
     if (foldmethodIsManual(curwin) || foldmethodIsMarker(curwin))
 	return TRUE;
@@ -602,9 +573,7 @@
  * window.
  */
     void
-foldCreate(start, end)
-    linenr_T	start;
-    linenr_T	end;
+foldCreate(linenr_T start, linenr_T end)
 {
     fold_T	*fp;
     garray_T	*gap;
@@ -729,11 +698,11 @@
  * When "recursive" is TRUE delete recursively.
  */
     void
-deleteFold(start, end, recursive, had_visual)
-    linenr_T	start;
-    linenr_T	end;
-    int		recursive;
-    int		had_visual;	/* TRUE when Visual selection used */
+deleteFold(
+    linenr_T	start,
+    linenr_T	end,
+    int		recursive,
+    int		had_visual)	/* TRUE when Visual selection used */
 {
     garray_T	*gap;
     fold_T	*fp;
@@ -824,8 +793,7 @@
  * Remove all folding for window "win".
  */
     void
-clearFolding(win)
-    win_T	*win;
+clearFolding(win_T *win)
 {
     deleteFoldRecurse(&win->w_folds);
     win->w_foldinvalid = FALSE;
@@ -839,10 +807,7 @@
  * The changes in lines from top to bot (inclusive).
  */
     void
-foldUpdate(wp, top, bot)
-    win_T	*wp;
-    linenr_T	top;
-    linenr_T	bot;
+foldUpdate(win_T *wp, linenr_T top, linenr_T bot)
 {
     fold_T	*fp;
 
@@ -880,8 +845,7 @@
  * every time a setting is changed or a syntax item is added.
  */
     void
-foldUpdateAll(win)
-    win_T	*win;
+foldUpdateAll(win_T *win)
 {
     win->w_foldinvalid = TRUE;
     redraw_win_later(win, NOT_VALID);
@@ -894,10 +858,10 @@
  * If not moved return FAIL.
  */
     int
-foldMoveTo(updown, dir, count)
-    int		updown;
-    int		dir;	    /* FORWARD or BACKWARD */
-    long	count;
+foldMoveTo(
+    int		updown,
+    int		dir,	    /* FORWARD or BACKWARD */
+    long	count)
 {
     long	n;
     int		retval = FAIL;
@@ -1031,8 +995,7 @@
  * Init the fold info in a new window.
  */
     void
-foldInitWin(new_win)
-    win_T	*new_win;
+foldInitWin(win_T *new_win)
 {
     ga_init2(&new_win->w_folds, (int)sizeof(fold_T), 10);
 }
@@ -1045,9 +1008,7 @@
  * Returns index of entry or -1 if not found.
  */
     int
-find_wl_entry(win, lnum)
-    win_T	*win;
-    linenr_T	lnum;
+find_wl_entry(win_T *win, linenr_T lnum)
 {
     int		i;
 
@@ -1067,7 +1028,7 @@
  * Adjust the Visual area to include any fold at the start or end completely.
  */
     void
-foldAdjustVisual()
+foldAdjustVisual(void)
 {
     pos_T	*start, *end;
     char_u	*ptr;
@@ -1106,7 +1067,7 @@
  * Move the cursor to the first line of a closed fold.
  */
     void
-foldAdjustCursor()
+foldAdjustCursor(void)
 {
     (void)hasFolding(curwin->w_cursor.lnum, &curwin->w_cursor.lnum, NULL);
 }
@@ -1119,9 +1080,7 @@
  * Return FAIL if the operation cannot be completed, otherwise OK.
  */
     void
-cloneFoldGrowArray(from, to)
-    garray_T	*from;
-    garray_T	*to;
+cloneFoldGrowArray(garray_T *from, garray_T *to)
 {
     int		i;
     fold_T	*from_p;
@@ -1155,10 +1114,7 @@
  * Returns FALSE when there is no fold that contains "lnum".
  */
     static int
-foldFind(gap, lnum, fpp)
-    garray_T	*gap;
-    linenr_T	lnum;
-    fold_T	**fpp;
+foldFind(garray_T *gap, linenr_T lnum, fold_T **fpp)
 {
     linenr_T	low, high;
     fold_T	*fp;
@@ -1197,9 +1153,7 @@
  * Return fold level at line number "lnum" in window "wp".
  */
     static int
-foldLevelWin(wp, lnum)
-    win_T	*wp;
-    linenr_T	lnum;
+foldLevelWin(win_T *wp, linenr_T lnum)
 {
     fold_T	*fp;
     linenr_T	lnum_rel = lnum;
@@ -1226,8 +1180,7 @@
  * Check if the folds in window "wp" are invalid and update them if needed.
  */
     static void
-checkupdate(wp)
-    win_T	*wp;
+checkupdate(win_T *wp)
 {
     if (wp->w_foldinvalid)
     {
@@ -1242,10 +1195,7 @@
  * Repeat "count" times.
  */
     static void
-setFoldRepeat(lnum, count, do_open)
-    linenr_T	lnum;
-    long	count;
-    int		do_open;
+setFoldRepeat(linenr_T lnum, long count, int do_open)
 {
     int		done;
     long	n;
@@ -1270,11 +1220,11 @@
  * Also does this for other windows in diff mode when needed.
  */
     static linenr_T
-setManualFold(lnum, opening, recurse, donep)
-    linenr_T	lnum;
-    int		opening;    /* TRUE when opening, FALSE when closing */
-    int		recurse;    /* TRUE when closing/opening recursive */
-    int		*donep;
+setManualFold(
+    linenr_T	lnum,
+    int		opening,    /* TRUE when opening, FALSE when closing */
+    int		recurse,    /* TRUE when closing/opening recursive */
+    int		*donep)
 {
 #ifdef FEAT_DIFF
     if (foldmethodIsDiff(curwin) && curwin->w_p_scb)
@@ -1312,12 +1262,12 @@
  * It's only valid when "opening" is TRUE!
  */
     static linenr_T
-setManualFoldWin(wp, lnum, opening, recurse, donep)
-    win_T	*wp;
-    linenr_T	lnum;
-    int		opening;    /* TRUE when opening, FALSE when closing */
-    int		recurse;    /* TRUE when closing/opening recursive */
-    int		*donep;
+setManualFoldWin(
+    win_T	*wp,
+    linenr_T	lnum,
+    int		opening,    /* TRUE when opening, FALSE when closing */
+    int		recurse,    /* TRUE when closing/opening recursive */
+    int		*donep)
 {
     fold_T	*fp;
     fold_T	*fp2;
@@ -1423,8 +1373,7 @@
  * Open all nested folds in fold "fpr" recursively.
  */
     static void
-foldOpenNested(fpr)
-    fold_T	*fpr;
+foldOpenNested(fold_T *fpr)
 {
     int		i;
     fold_T	*fp;
@@ -1444,10 +1393,7 @@
  * When "recursive" is FALSE contained folds are moved one level up.
  */
     static void
-deleteFoldEntry(gap, idx, recursive)
-    garray_T	*gap;
-    int		idx;
-    int		recursive;
+deleteFoldEntry(garray_T *gap, int idx, int recursive)
 {
     fold_T	*fp;
     int		i;
@@ -1501,8 +1447,7 @@
  * Delete nested folds in a fold.
  */
     void
-deleteFoldRecurse(gap)
-    garray_T	*gap;
+deleteFoldRecurse(garray_T *gap)
 {
     int		i;
 
@@ -1516,12 +1461,12 @@
  * Update line numbers of folds for inserted/deleted lines.
  */
     void
-foldMarkAdjust(wp, line1, line2, amount, amount_after)
-    win_T	*wp;
-    linenr_T	line1;
-    linenr_T	line2;
-    long	amount;
-    long	amount_after;
+foldMarkAdjust(
+    win_T	*wp,
+    linenr_T	line1,
+    linenr_T	line2,
+    long	amount,
+    long	amount_after)
 {
     /* If deleting marks from line1 to line2, but not deleting all those
      * lines, set line2 so that only deleted lines have their folds removed. */
@@ -1536,12 +1481,12 @@
 
 /* foldMarkAdjustRecurse() {{{2 */
     static void
-foldMarkAdjustRecurse(gap, line1, line2, amount, amount_after)
-    garray_T	*gap;
-    linenr_T	line1;
-    linenr_T	line2;
-    long	amount;
-    long	amount_after;
+foldMarkAdjustRecurse(
+    garray_T	*gap,
+    linenr_T	line1,
+    linenr_T	line2,
+    long	amount,
+    long	amount_after)
 {
     fold_T	*fp;
     int		i;
@@ -1653,15 +1598,14 @@
  * current window open.
  */
     int
-getDeepestNesting()
+getDeepestNesting(void)
 {
     checkupdate(curwin);
     return getDeepestNestingRecurse(&curwin->w_folds);
 }
 
     static int
-getDeepestNestingRecurse(gap)
-    garray_T	*gap;
+getDeepestNestingRecurse(garray_T *gap)
 {
     int		i;
     int		level;
@@ -1684,13 +1628,13 @@
  * Check if a fold is closed and update the info needed to check nested folds.
  */
     static int
-check_closed(win, fp, use_levelp, level, maybe_smallp, lnum_off)
-    win_T	*win;
-    fold_T	*fp;
-    int		*use_levelp;	    /* TRUE: outer fold had FD_LEVEL */
-    int		level;		    /* folding depth */
-    int		*maybe_smallp;	    /* TRUE: outer this had fd_small == MAYBE */
-    linenr_T	lnum_off;	    /* line number offset for fp->fd_top */
+check_closed(
+    win_T	*win,
+    fold_T	*fp,
+    int		*use_levelp,	    /* TRUE: outer fold had FD_LEVEL */
+    int		level,		    /* folding depth */
+    int		*maybe_smallp,	    /* TRUE: outer this had fd_small == MAYBE */
+    linenr_T	lnum_off)	    /* line number offset for fp->fd_top */
 {
     int		closed = FALSE;
 
@@ -1724,10 +1668,10 @@
  * Update fd_small field of fold "fp".
  */
     static void
-checkSmall(wp, fp, lnum_off)
-    win_T	*wp;
-    fold_T	*fp;
-    linenr_T	lnum_off;	/* offset for fp->fd_top */
+checkSmall(
+    win_T	*wp,
+    fold_T	*fp,
+    linenr_T	lnum_off)	/* offset for fp->fd_top */
 {
     int		count;
     int		n;
@@ -1761,8 +1705,7 @@
  * Set small flags in "gap" to MAYBE.
  */
     static void
-setSmallMaybe(gap)
-    garray_T	*gap;
+setSmallMaybe(garray_T *gap)
 {
     int		i;
     fold_T	*fp;
@@ -1778,9 +1721,7 @@
  * window by adding markers.
  */
     static void
-foldCreateMarkers(start, end)
-    linenr_T	start;
-    linenr_T	end;
+foldCreateMarkers(linenr_T start, linenr_T end)
 {
     if (!curbuf->b_p_ma)
     {
@@ -1802,10 +1743,7 @@
  * Add "marker[markerlen]" in 'commentstring' to line "lnum".
  */
     static void
-foldAddMarker(lnum, marker, markerlen)
-    linenr_T	lnum;
-    char_u	*marker;
-    int		markerlen;
+foldAddMarker(linenr_T lnum, char_u *marker, int markerlen)
 {
     char_u	*cms = curbuf->b_p_cms;
     char_u	*line;
@@ -1841,10 +1779,10 @@
  * Delete the markers for a fold, causing it to be deleted.
  */
     static void
-deleteFoldMarkers(fp, recursive, lnum_off)
-    fold_T	*fp;
-    int		recursive;
-    linenr_T	lnum_off;	/* offset for fp->fd_top */
+deleteFoldMarkers(
+    fold_T	*fp,
+    int		recursive,
+    linenr_T	lnum_off)	/* offset for fp->fd_top */
 {
     int		i;
 
@@ -1865,10 +1803,7 @@
  * close-marker.
  */
     static void
-foldDelMarker(lnum, marker, markerlen)
-    linenr_T	lnum;
-    char_u	*marker;
-    int		markerlen;
+foldDelMarker(linenr_T lnum, char_u *marker, int markerlen)
 {
     char_u	*line;
     char_u	*newline;
@@ -1919,11 +1854,12 @@
  * result is in allocated memory.
  */
     char_u *
-get_foldtext(wp, lnum, lnume, foldinfo, buf)
-    win_T	*wp;
-    linenr_T	lnum, lnume;
-    foldinfo_T	*foldinfo;
-    char_u	*buf;
+get_foldtext(
+    win_T	*wp,
+    linenr_T	lnum,
+    linenr_T	lnume,
+    foldinfo_T	*foldinfo,
+    char_u	*buf)
 {
     char_u	*text = NULL;
 #ifdef FEAT_EVAL
@@ -2033,8 +1969,7 @@
  * Remove 'foldmarker' and 'commentstring' from "str" (in-place).
  */
     void
-foldtext_cleanup(str)
-    char_u	*str;
+foldtext_cleanup(char_u *str)
 {
     char_u	*cms_start;	/* first part or the whole comment */
     int		cms_slen = 0;	/* length of cms_start */
@@ -2161,10 +2096,7 @@
  * Return TRUE if any folds did change.
  */
     static void
-foldUpdateIEMS(wp, top, bot)
-    win_T	*wp;
-    linenr_T	top;
-    linenr_T	bot;
+foldUpdateIEMS(win_T *wp, linenr_T top, linenr_T bot)
 {
     linenr_T	start;
     linenr_T	end;
@@ -2417,14 +2349,14 @@
  * updated as a result of a detected change in the fold.
  */
     static linenr_T
-foldUpdateIEMSRecurse(gap, level, startlnum, flp, getlevel, bot, topflags)
-    garray_T	*gap;
-    int		level;
-    linenr_T	startlnum;
-    fline_T	*flp;
-    void	(*getlevel)(fline_T *);
-    linenr_T	bot;
-    int		topflags;	/* flags used by containing fold */
+foldUpdateIEMSRecurse(
+    garray_T	*gap,
+    int		level,
+    linenr_T	startlnum,
+    fline_T	*flp,
+    void	(*getlevel)(fline_T *),
+    linenr_T	bot,
+    int		topflags)	/* flags used by containing fold */
 {
     linenr_T	ll;
     fold_T	*fp = NULL;
@@ -2831,9 +2763,7 @@
  * Returns OK for success, FAIL for failure.
  */
     static int
-foldInsert(gap, i)
-    garray_T	*gap;
-    int		i;
+foldInsert(garray_T *gap, int i)
 {
     fold_T	*fp;
 
@@ -2856,11 +2786,11 @@
  * "bot"!
  */
     static void
-foldSplit(gap, i, top, bot)
-    garray_T	*gap;
-    int		i;
-    linenr_T	top;
-    linenr_T	bot;
+foldSplit(
+    garray_T	*gap,
+    int		i,
+    linenr_T	top,
+    linenr_T	bot)
 {
     fold_T	*fp;
     fold_T	*fp2;
@@ -2920,10 +2850,7 @@
  * 6: not changed
  */
     static void
-foldRemove(gap, top, bot)
-    garray_T	*gap;
-    linenr_T	top;
-    linenr_T	bot;
+foldRemove(garray_T *gap, linenr_T top, linenr_T bot)
 {
     fold_T	*fp = NULL;
 
@@ -2986,10 +2913,7 @@
  * Fold entry "fp2" in "gap" is deleted.
  */
     static void
-foldMerge(fp1, gap, fp2)
-    fold_T	*fp1;
-    garray_T	*gap;
-    fold_T	*fp2;
+foldMerge(fold_T *fp1, garray_T *gap, fold_T *fp2)
 {
     fold_T	*fp3;
     fold_T	*fp4;
@@ -3027,8 +2951,7 @@
  * Returns a level of -1 if the foldlevel depends on surrounding lines.
  */
     static void
-foldlevelIndent(flp)
-    fline_T	*flp;
+foldlevelIndent(fline_T *flp)
 {
     char_u	*s;
     buf_T	*buf;
@@ -3064,8 +2987,7 @@
  * Doesn't use any caching.
  */
     static void
-foldlevelDiff(flp)
-    fline_T	*flp;
+foldlevelDiff(fline_T *flp)
 {
     if (diff_infold(flp->wp, flp->lnum + flp->off))
 	flp->lvl = 1;
@@ -3081,8 +3003,7 @@
  * Returns a level of -1 if the foldlevel depends on surrounding lines.
  */
     static void
-foldlevelExpr(flp)
-    fline_T	*flp;
+foldlevelExpr(fline_T *flp)
 {
 #ifndef FEAT_EVAL
     flp->start = FALSE;
@@ -3184,8 +3105,7 @@
  * Relies on the option value to have been checked for correctness already.
  */
     static void
-parseMarker(wp)
-    win_T	*wp;
+parseMarker(win_T *wp)
 {
     foldendmarker = vim_strchr(wp->w_p_fmr, ',');
     foldstartmarkerlen = (int)(foldendmarker++ - wp->w_p_fmr);
@@ -3203,8 +3123,7 @@
  * Sets flp->start when a start marker was found.
  */
     static void
-foldlevelMarker(flp)
-    fline_T	*flp;
+foldlevelMarker(fline_T *flp)
 {
     char_u	*startmarker;
     int		cstart;
@@ -3286,8 +3205,7 @@
  * Doesn't use any caching.
  */
     static void
-foldlevelSyntax(flp)
-    fline_T	*flp;
+foldlevelSyntax(fline_T *flp)
 {
 #ifndef FEAT_SYN_HL
     flp->start = 0;
@@ -3323,9 +3241,7 @@
  * Return FAIL if writing fails.
  */
     int
-put_folds(fd, wp)
-    FILE	*fd;
-    win_T	*wp;
+put_folds(FILE *fd, win_T *wp)
 {
     if (foldmethodIsManual(wp))
     {
@@ -3347,10 +3263,7 @@
  * Returns FAIL when writing failed.
  */
     static int
-put_folds_recurse(fd, gap, off)
-    FILE	*fd;
-    garray_T	*gap;
-    linenr_T	off;
+put_folds_recurse(FILE *fd, garray_T *gap, linenr_T off)
 {
     int		i;
     fold_T	*fp;
@@ -3376,11 +3289,11 @@
  * Returns FAIL when writing failed.
  */
     static int
-put_foldopen_recurse(fd, wp, gap, off)
-    FILE	*fd;
-    win_T	*wp;
-    garray_T	*gap;
-    linenr_T	off;
+put_foldopen_recurse(
+    FILE	*fd,
+    win_T	*wp,
+    garray_T	*gap,
+    linenr_T	off)
 {
     int		i;
     int		level;
@@ -3433,10 +3346,7 @@
  * Returns FAIL when writing failed.
  */
     static int
-put_fold_open_close(fd, fp, off)
-    FILE	*fd;
-    fold_T	*fp;
-    linenr_T	off;
+put_fold_open_close(FILE *fd, fold_T *fp, linenr_T off)
 {
     if (fprintf(fd, "%ld", fp->fd_top + off) < 0
 	    || put_eol(fd) == FAIL
diff --git a/src/getchar.c b/src/getchar.c
index e6a4f0b..7a5756b 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -137,8 +137,7 @@
  * Free and clear a buffer.
  */
     void
-free_buff(buf)
-    buffheader_T	*buf;
+free_buff(buffheader_T *buf)
 {
     buffblock_T	*p, *np;
 
@@ -155,9 +154,9 @@
  * K_SPECIAL and CSI in the returned string are escaped.
  */
     static char_u *
-get_buffcont(buffer, dozero)
-    buffheader_T	*buffer;
-    int			dozero;	    /* count == zero is not an error */
+get_buffcont(
+    buffheader_T	*buffer,
+    int			dozero)	    /* count == zero is not an error */
 {
     long_u	    count = 0;
     char_u	    *p = NULL;
@@ -186,7 +185,7 @@
  * K_SPECIAL and CSI in the returned string are escaped.
  */
     char_u *
-get_recorded()
+get_recorded(void)
 {
     char_u	*p;
     size_t	len;
@@ -220,7 +219,7 @@
  * K_SPECIAL and CSI in the returned string are escaped.
  */
     char_u *
-get_inserted()
+get_inserted(void)
 {
     return get_buffcont(&redobuff, FALSE);
 }
@@ -230,10 +229,10 @@
  * K_SPECIAL and CSI should have been escaped already.
  */
     static void
-add_buff(buf, s, slen)
-    buffheader_T	*buf;
-    char_u		*s;
-    long		slen;	/* length of "s" or -1 */
+add_buff(
+    buffheader_T	*buf,
+    char_u		*s,
+    long		slen)	/* length of "s" or -1 */
 {
     buffblock_T *p;
     long_u	    len;
@@ -289,9 +288,7 @@
  * Add number "n" to buffer "buf".
  */
     static void
-add_num_buff(buf, n)
-    buffheader_T *buf;
-    long	      n;
+add_num_buff(buffheader_T *buf, long n)
 {
     char_u	number[32];
 
@@ -304,9 +301,7 @@
  * Translates special keys, NUL, CSI, K_SPECIAL and multibyte characters.
  */
     static void
-add_char_buff(buf, c)
-    buffheader_T	*buf;
-    int			c;
+add_char_buff(buffheader_T *buf, int c)
 {
 #ifdef FEAT_MBYTE
     char_u	bytes[MB_MAXBYTES + 1];
@@ -368,8 +363,7 @@
  * No translation is done K_SPECIAL and CSI are escaped.
  */
     static int
-read_readbuffers(advance)
-    int		advance;
+read_readbuffers(int advance)
 {
     int c;
 
@@ -380,9 +374,7 @@
 }
 
     static int
-read_readbuf(buf, advance)
-    buffheader_T    *buf;
-    int		    advance;
+read_readbuf(buffheader_T *buf, int advance)
 {
     char_u	c;
     buffblock_T	*curr;
@@ -409,7 +401,7 @@
  * Prepare the read buffers for reading (if they contain something).
  */
     static void
-start_stuff()
+start_stuff(void)
 {
     if (readbuf1.bh_first.b_next != NULL)
     {
@@ -427,7 +419,7 @@
  * Return TRUE if the stuff buffer is empty.
  */
     int
-stuff_empty()
+stuff_empty(void)
 {
     return (readbuf1.bh_first.b_next == NULL
 	 && readbuf2.bh_first.b_next == NULL);
@@ -438,7 +430,7 @@
  * redbuf2.
  */
     int
-readbuf1_empty()
+readbuf1_empty(void)
 {
     return (readbuf1.bh_first.b_next == NULL);
 }
@@ -447,8 +439,7 @@
  * Set a typeahead character that won't be flushed.
  */
     void
-typeahead_noflush(c)
-    int		c;
+typeahead_noflush(int c)
 {
     typeahead_char = c;
 }
@@ -459,8 +450,7 @@
  * flush all typeahead characters (used when interrupted by a CTRL-C).
  */
     void
-flush_buffers(flush_typeahead)
-    int flush_typeahead;
+flush_buffers(int flush_typeahead)
 {
     init_typebuf();
 
@@ -497,7 +487,7 @@
  * This is used for the CTRL-O <.> command in insert mode.
  */
     void
-ResetRedobuff()
+ResetRedobuff(void)
 {
     if (!block_redo)
     {
@@ -512,7 +502,7 @@
  * buffer.
  */
     void
-CancelRedo()
+CancelRedo(void)
 {
     if (!block_redo)
     {
@@ -533,7 +523,7 @@
 static int save_level = 0;
 
     void
-saveRedobuff()
+saveRedobuff(void)
 {
     char_u	*s;
 
@@ -559,7 +549,7 @@
  * Used after executing autocommands and user functions.
  */
     void
-restoreRedobuff()
+restoreRedobuff(void)
 {
     if (--save_level == 0)
     {
@@ -576,8 +566,7 @@
  * K_SPECIAL and CSI should already have been escaped.
  */
     void
-AppendToRedobuff(s)
-    char_u	   *s;
+AppendToRedobuff(char_u *s)
 {
     if (!block_redo)
 	add_buff(&redobuff, s, -1L);
@@ -588,9 +577,9 @@
  * K_SPECIAL and CSI are escaped as well.
  */
     void
-AppendToRedobuffLit(str, len)
-    char_u	*str;
-    int		len;	    /* length of "str" or -1 for up to the NUL */
+AppendToRedobuffLit(
+    char_u	*str,
+    int		len)	    /* length of "str" or -1 for up to the NUL */
 {
     char_u	*s = str;
     int		c;
@@ -649,8 +638,7 @@
  * Translates special keys, NUL, CSI, K_SPECIAL and multibyte characters.
  */
     void
-AppendCharToRedobuff(c)
-    int		   c;
+AppendCharToRedobuff(int c)
 {
     if (!block_redo)
 	add_char_buff(&redobuff, c);
@@ -660,8 +648,7 @@
  * Append a number to the redo buffer.
  */
     void
-AppendNumberToRedobuff(n)
-    long	    n;
+AppendNumberToRedobuff(long n)
 {
     if (!block_redo)
 	add_num_buff(&redobuff, n);
@@ -672,8 +659,7 @@
  * CSI and K_SPECIAL must already have been escaped.
  */
     void
-stuffReadbuff(s)
-    char_u	*s;
+stuffReadbuff(char_u *s)
 {
     add_buff(&readbuf1, s, -1L);
 }
@@ -683,16 +669,13 @@
  * CSI and K_SPECIAL must already have been escaped.
  */
     void
-stuffRedoReadbuff(s)
-    char_u	*s;
+stuffRedoReadbuff(char_u *s)
 {
     add_buff(&readbuf2, s, -1L);
 }
 
     void
-stuffReadbuffLen(s, len)
-    char_u	*s;
-    long	len;
+stuffReadbuffLen(char_u *s, long len)
 {
     add_buff(&readbuf1, s, len);
 }
@@ -704,8 +687,7 @@
  * Change CR, LF and ESC into a space.
  */
     void
-stuffReadbuffSpec(s)
-    char_u	*s;
+stuffReadbuffSpec(char_u *s)
 {
     int c;
 
@@ -737,8 +719,7 @@
  * Translates special keys, NUL, CSI, K_SPECIAL and multibyte characters.
  */
     void
-stuffcharReadbuff(c)
-    int		   c;
+stuffcharReadbuff(int c)
 {
     add_char_buff(&readbuf1, c);
 }
@@ -747,8 +728,7 @@
  * Append a number to the stuff buffer.
  */
     void
-stuffnumReadbuff(n)
-    long    n;
+stuffnumReadbuff(long n)
 {
     add_num_buff(&readbuf1, n);
 }
@@ -762,9 +742,7 @@
  * If old is TRUE, use old_redobuff instead of redobuff.
  */
     static int
-read_redo(init, old_redo)
-    int		init;
-    int		old_redo;
+read_redo(int init, int old_redo)
 {
     static buffblock_T	*bp;
     static char_u	*p;
@@ -837,8 +815,7 @@
  * The escaped K_SPECIAL and CSI are copied without translation.
  */
     static void
-copy_redo(old_redo)
-    int	    old_redo;
+copy_redo(int old_redo)
 {
     int	    c;
 
@@ -856,9 +833,7 @@
  * return FAIL for failure, OK otherwise
  */
     int
-start_redo(count, old_redo)
-    long    count;
-    int	    old_redo;
+start_redo(long count, int old_redo)
 {
     int	    c;
 
@@ -911,7 +886,7 @@
  * return FAIL for failure, OK otherwise
  */
     int
-start_redo_ins()
+start_redo_ins(void)
 {
     int	    c;
 
@@ -937,7 +912,7 @@
 }
 
     void
-stop_redo_ins()
+stop_redo_ins(void)
 {
     block_redo = FALSE;
 }
@@ -948,7 +923,7 @@
  * be impossible to type anything.
  */
     static void
-init_typebuf()
+init_typebuf(void)
 {
     if (typebuf.tb_buf == NULL)
     {
@@ -981,12 +956,12 @@
  * return FAIL for failure, OK otherwise
  */
     int
-ins_typebuf(str, noremap, offset, nottyped, silent)
-    char_u	*str;
-    int		noremap;
-    int		offset;
-    int		nottyped;
-    int		silent;
+ins_typebuf(
+    char_u	*str,
+    int		noremap,
+    int		offset,
+    int		nottyped,
+    int		silent)
 {
     char_u	*s1, *s2;
     int		newlen;
@@ -1114,8 +1089,7 @@
  * the char.
  */
     void
-ins_char_typebuf(c)
-    int	    c;
+ins_char_typebuf(int c)
 {
 #ifdef FEAT_MBYTE
     char_u	buf[MB_MAXBYTES + 1];
@@ -1151,8 +1125,8 @@
  * that was just added.
  */
     int
-typebuf_changed(tb_change_cnt)
-    int		tb_change_cnt;	/* old value of typebuf.tb_change_cnt */
+typebuf_changed(
+    int		tb_change_cnt)	/* old value of typebuf.tb_change_cnt */
 {
     return (tb_change_cnt != 0 && (typebuf.tb_change_cnt != tb_change_cnt
 #if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL)
@@ -1166,7 +1140,7 @@
  * not been typed (result from a mapping or come from ":normal").
  */
     int
-typebuf_typed()
+typebuf_typed(void)
 {
     return typebuf.tb_maplen == 0;
 }
@@ -1175,7 +1149,7 @@
  * Return the number of characters that are mapped (or not typed).
  */
     int
-typebuf_maplen()
+typebuf_maplen(void)
 {
     return typebuf.tb_maplen;
 }
@@ -1184,9 +1158,7 @@
  * remove "len" characters from typebuf.tb_buf[typebuf.tb_off + offset]
  */
     void
-del_typebuf(len, offset)
-    int	len;
-    int	offset;
+del_typebuf(int len, int offset)
 {
     int	    i;
 
@@ -1264,9 +1236,7 @@
  * If recording is on put the character in the recordbuffer.
  */
     static void
-gotchars(chars, len)
-    char_u	*chars;
-    int		len;
+gotchars(char_u *chars, int len)
 {
     char_u	*s = chars;
     int		c;
@@ -1311,7 +1281,7 @@
  * - When no_u_sync is non-zero.
  */
     static void
-may_sync_undo()
+may_sync_undo(void)
 {
     if ((!(State & (INSERT + CMDLINE)) || arrow_used)
 					       && scriptin[curscript] == NULL)
@@ -1323,7 +1293,7 @@
  * Returns FAIL when out of memory.
  */
     int
-alloc_typebuf()
+alloc_typebuf(void)
 {
     typebuf.tb_buf = alloc(TYPELEN_INIT);
     typebuf.tb_noremap = alloc(TYPELEN_INIT);
@@ -1347,7 +1317,7 @@
  * Free the buffers of "typebuf".
  */
     void
-free_typebuf()
+free_typebuf(void)
 {
     if (typebuf.tb_buf == typebuf_init)
 	EMSG2(_(e_intern2), "Free typebuf 1");
@@ -1366,7 +1336,7 @@
 static typebuf_T saved_typebuf[NSCRIPT];
 
     int
-save_typebuf()
+save_typebuf(void)
 {
     init_typebuf();
     saved_typebuf[curscript] = typebuf;
@@ -1392,8 +1362,7 @@
  * Save all three kinds of typeahead, so that the user must type at a prompt.
  */
     void
-save_typeahead(tp)
-    tasave_T	*tp;
+save_typeahead(tasave_T *tp)
 {
     tp->save_typebuf = typebuf;
     tp->typebuf_valid = (alloc_typebuf() == OK);
@@ -1418,8 +1387,7 @@
  * The allocated memory is freed, can only be called once!
  */
     void
-restore_typeahead(tp)
-    tasave_T	*tp;
+restore_typeahead(tasave_T *tp)
 {
     if (tp->typebuf_valid)
     {
@@ -1444,9 +1412,9 @@
  * Open a new script file for the ":source!" command.
  */
     void
-openscript(name, directly)
-    char_u	*name;
-    int		directly;	/* when TRUE execute directly */
+openscript(
+    char_u	*name,
+    int		directly)	/* when TRUE execute directly */
 {
     if (curscript + 1 == NSCRIPT)
     {
@@ -1517,7 +1485,7 @@
  * Close the currently active input script.
  */
     static void
-closescript()
+closescript(void)
 {
     free_typebuf();
     typebuf = saved_typebuf[curscript];
@@ -1530,7 +1498,7 @@
 
 #if defined(EXITFREE) || defined(PROTO)
     void
-close_all_scripts()
+close_all_scripts(void)
 {
     while (scriptin[0] != NULL)
 	closescript();
@@ -1542,7 +1510,7 @@
  * Return TRUE when reading keys from a script file.
  */
     int
-using_script()
+using_script(void)
 {
     return scriptin[curscript] != NULL;
 }
@@ -1553,7 +1521,7 @@
  * waiting 'updatetime' for a character to arrive.
  */
     void
-before_blocking()
+before_blocking(void)
 {
     updatescript(0);
 #ifdef FEAT_EVAL
@@ -1570,8 +1538,7 @@
  * characters reaches 'updatecount' and 'updatecount' is non-zero.
  */
     void
-updatescript(c)
-    int c;
+updatescript(int c)
 {
     static int	    count = 0;
 
@@ -1594,7 +1561,7 @@
  * Returns the modifiers in the global "mod_mask".
  */
     int
-vgetc()
+vgetc(void)
 {
     int		c, c2;
 #ifdef FEAT_MBYTE
@@ -1839,7 +1806,7 @@
  * directly from the user (ignoring typeahead).
  */
     int
-safe_vgetc()
+safe_vgetc(void)
 {
     int	c;
 
@@ -1854,7 +1821,7 @@
  * Also ignore scrollbar events.
  */
     int
-plain_vgetc()
+plain_vgetc(void)
 {
     int c;
 
@@ -1871,7 +1838,7 @@
  * character is not valid!.
  */
     int
-vpeekc()
+vpeekc(void)
 {
     if (old_char != -1)
 	return old_char;
@@ -1884,7 +1851,7 @@
  * codes.
  */
     int
-vpeekc_nomap()
+vpeekc_nomap(void)
 {
     int		c;
 
@@ -1904,7 +1871,7 @@
  * buffer, it must be an ESC that is recognized as the start of a key code.
  */
     int
-vpeekc_any()
+vpeekc_any(void)
 {
     int		c;
 
@@ -1920,7 +1887,7 @@
  * Return TRUE if a character is available, FALSE otherwise.
  */
     int
-char_avail()
+char_avail(void)
 {
     int	    retval;
 
@@ -1930,9 +1897,11 @@
     return (retval != NUL);
 }
 
+/*
+ * unget one character (can only be done once!)
+ */
     void
-vungetc(c)	/* unget one character (can only be done once!) */
-    int		c;
+vungetc(int c)
 {
     old_char = c;
     old_mod_mask = mod_mask;
@@ -1966,8 +1935,7 @@
  * K_SPECIAL and CSI may be escaped, need to get two more bytes then.
  */
     static int
-vgetorpeek(advance)
-    int	    advance;
+vgetorpeek(int advance)
 {
     int		c, c1;
     int		keylen;
@@ -2988,11 +2956,11 @@
  *  Return -1 when end of input script reached.
  */
     int
-inchar(buf, maxlen, wait_time, tb_change_cnt)
-    char_u	*buf;
-    int		maxlen;
-    long	wait_time;	    /* milli seconds */
-    int		tb_change_cnt;
+inchar(
+    char_u	*buf,
+    int		maxlen,
+    long	wait_time,	    /* milli seconds */
+    int		tb_change_cnt)
 {
     int		len = 0;	    /* init for GCC */
     int		retesc = FALSE;	    /* return ESC with gotint */
@@ -3114,10 +3082,10 @@
  * Returns the new length.
  */
     int
-fix_input_buffer(buf, len, script)
-    char_u	*buf;
-    int		len;
-    int		script;		/* TRUE when reading from a script */
+fix_input_buffer(
+    char_u	*buf,
+    int		len,
+    int		script)		/* TRUE when reading from a script */
 {
     int		i;
     char_u	*p = buf;
@@ -3182,7 +3150,7 @@
  * waiting for input to arrive.
  */
     int
-input_available()
+input_available(void)
 {
     return (!vim_is_input_buf_empty()
 # if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL)
@@ -3231,11 +3199,11 @@
  *	  5 for entry not unique
  */
     int
-do_map(maptype, arg, mode, abbrev)
-    int		maptype;
-    char_u	*arg;
-    int		mode;
-    int		abbrev;		/* not a mapping but an abbreviation */
+do_map(
+    int		maptype,
+    char_u	*arg,
+    int		mode,
+    int		abbrev)		/* not a mapping but an abbreviation */
 {
     char_u	*keys;
     mapblock_T	*mp, **mpp;
@@ -3810,8 +3778,7 @@
  * "mpp" is a pointer to the m_next field of the PREVIOUS entry!
  */
     static void
-map_free(mpp)
-    mapblock_T	**mpp;
+map_free(mapblock_T **mpp)
 {
     mapblock_T	*mp;
 
@@ -3827,7 +3794,7 @@
  * Initialize maphash[] for first use.
  */
     static void
-validate_maphash()
+validate_maphash(void)
 {
     if (!maphash_valid)
     {
@@ -3840,9 +3807,7 @@
  * Get the mapping mode from the command name.
  */
     int
-get_map_mode(cmdp, forceit)
-    char_u	**cmdp;
-    int		forceit;
+get_map_mode(char_u **cmdp, int forceit)
 {
     char_u	*p;
     int		modec;
@@ -3884,11 +3849,11 @@
  * 'abbr' should be FALSE for mappings, TRUE for abbreviations.
  */
     void
-map_clear(cmdp, arg, forceit, abbr)
-    char_u	*cmdp;
-    char_u	*arg UNUSED;
-    int		forceit;
-    int		abbr;
+map_clear(
+    char_u	*cmdp,
+    char_u	*arg UNUSED,
+    int		forceit,
+    int		abbr)
 {
     int		mode;
 #ifdef FEAT_LOCALMAP
@@ -3916,11 +3881,11 @@
  * Clear all mappings in "mode".
  */
     void
-map_clear_int(buf, mode, local, abbr)
-    buf_T	*buf UNUSED;	/* buffer for local mappings */
-    int		mode;		/* mode in which to delete */
-    int		local UNUSED;	/* TRUE for buffer-local mappings */
-    int		abbr;		/* TRUE for abbreviations */
+map_clear_int(
+    buf_T	*buf UNUSED,	/* buffer for local mappings */
+    int		mode,		/* mode in which to delete */
+    int		local UNUSED,	/* TRUE for buffer-local mappings */
+    int		abbr)		/* TRUE for abbreviations */
 {
     mapblock_T	*mp, **mpp;
     int		hash;
@@ -3993,8 +3958,7 @@
  * Returns NULL when out of memory.
  */
     char_u *
-map_mode_to_chars(mode)
-    int mode;
+map_mode_to_chars(int mode)
 {
     garray_T    mapmode;
 
@@ -4033,9 +3997,9 @@
 }
 
     static void
-showmap(mp, local)
-    mapblock_T	*mp;
-    int		local;	    /* TRUE for buffer-local map */
+showmap(
+    mapblock_T	*mp,
+    int		local)	    /* TRUE for buffer-local map */
 {
     int		len = 1;
     char_u	*mapchars;
@@ -4108,10 +4072,7 @@
  * Also checks mappings local to the current buffer.
  */
     int
-map_to_exists(str, modechars, abbr)
-    char_u	*str;
-    char_u	*modechars;
-    int		abbr;
+map_to_exists(char_u *str, char_u *modechars, int abbr)
 {
     int		mode = 0;
     char_u	*rhs;
@@ -4149,10 +4110,7 @@
  * Also checks mappings local to the current buffer.
  */
     int
-map_to_exists_mode(rhs, mode, abbr)
-    char_u	*rhs;
-    int		mode;
-    int		abbr;
+map_to_exists_mode(char_u *rhs, int mode, int abbr)
 {
     mapblock_T	*mp;
     int		hash;
@@ -4216,14 +4174,14 @@
  * or abbreviation names.
  */
     char_u *
-set_context_in_map_cmd(xp, cmd, arg, forceit, isabbrev, isunmap, cmdidx)
-    expand_T	*xp;
-    char_u	*cmd;
-    char_u	*arg;
-    int		forceit;	/* TRUE if '!' given */
-    int		isabbrev;	/* TRUE if abbreviation */
-    int		isunmap;	/* TRUE if unmap/unabbrev command */
-    cmdidx_T	cmdidx;
+set_context_in_map_cmd(
+    expand_T	*xp,
+    char_u	*cmd,
+    char_u	*arg,
+    int		forceit,	/* TRUE if '!' given */
+    int		isabbrev,	/* TRUE if abbreviation */
+    int		isunmap,	/* TRUE if unmap/unabbrev command */
+    cmdidx_T	cmdidx)
 {
     if (forceit && cmdidx != CMD_map && cmdidx != CMD_unmap)
 	xp->xp_context = EXPAND_NOTHING;
@@ -4293,10 +4251,10 @@
  * Return OK if matches found, FAIL otherwise.
  */
     int
-ExpandMappings(regmatch, num_file, file)
-    regmatch_T	*regmatch;
-    int		*num_file;
-    char_u	***file;
+ExpandMappings(
+    regmatch_T	*regmatch,
+    int		*num_file,
+    char_u	***file)
 {
     mapblock_T	*mp;
     int		hash;
@@ -4441,11 +4399,11 @@
  * return TRUE if there is an abbreviation, FALSE if not
  */
     int
-check_abbr(c, ptr, col, mincol)
-    int		c;
-    char_u	*ptr;
-    int		col;
-    int		mincol;
+check_abbr(
+    int		c,
+    char_u	*ptr,
+    int		col,
+    int		mincol)
 {
     int		len;
     int		scol;		/* starting column of the abbr. */
@@ -4651,9 +4609,9 @@
  * special characters.
  */
     static char_u *
-eval_map_expr(str, c)
-    char_u	*str;
-    int		c;	    /* NUL or typed character for abbreviation */
+eval_map_expr(
+    char_u	*str,
+    int		c)	    /* NUL or typed character for abbreviation */
 {
     char_u	*res;
     char_u	*p;
@@ -4715,8 +4673,8 @@
  * Returns NULL when out of memory.
  */
     char_u *
-vim_strsave_escape_csi(p)
-    char_u *p;
+vim_strsave_escape_csi(
+    char_u *p)
 {
     char_u	*res;
     char_u	*s, *d;
@@ -4765,8 +4723,7 @@
  * vim_strsave_escape_csi().  Works in-place.
  */
     void
-vim_unescape_csi(p)
-    char_u *p;
+vim_unescape_csi(char_u *p)
 {
     char_u	*s = p, *d = p;
 
@@ -4794,9 +4751,9 @@
  * Return FAIL on error, OK otherwise.
  */
     int
-makemap(fd, buf)
-    FILE	*fd;
-    buf_T	*buf;	    /* buffer for local mappings or NULL */
+makemap(
+    FILE	*fd,
+    buf_T	*buf)	    /* buffer for local mappings or NULL */
 {
     mapblock_T	*mp;
     char_u	c1, c2, c3;
@@ -5007,10 +4964,7 @@
  * return FAIL for failure, OK otherwise
  */
     int
-put_escstr(fd, strstart, what)
-    FILE	*fd;
-    char_u	*strstart;
-    int		what;
+put_escstr(FILE *fd, char_u *strstart, int what)
 {
     char_u	*str = strstart;
     int		c;
@@ -5123,7 +5077,7 @@
  * Used after ":set term=xxx".
  */
     void
-check_map_keycodes()
+check_map_keycodes(void)
 {
     mapblock_T	*mp;
     char_u	*p;
@@ -5215,14 +5169,14 @@
  * NULL when no mapping found.
  */
     char_u *
-check_map(keys, mode, exact, ign_mod, abbr, mp_ptr, local_ptr)
-    char_u	*keys;
-    int		mode;
-    int		exact;		/* require exact match */
-    int		ign_mod;	/* ignore preceding modifier */
-    int		abbr;		/* do abbreviations */
-    mapblock_T	**mp_ptr;	/* return: pointer to mapblock or NULL */
-    int		*local_ptr;	/* return: buffer-local mapping or NULL */
+check_map(
+    char_u	*keys,
+    int		mode,
+    int		exact,		/* require exact match */
+    int		ign_mod,	/* ignore preceding modifier */
+    int		abbr,		/* do abbreviations */
+    mapblock_T	**mp_ptr,	/* return: pointer to mapblock or NULL */
+    int		*local_ptr)	/* return: buffer-local mapping or NULL */
 {
     int		hash;
     int		len, minlen;
@@ -5378,7 +5332,7 @@
  * Set up default mappings.
  */
     void
-init_mappings()
+init_mappings(void)
 {
 #if defined(MSDOS) || defined(MSWIN) ||defined(MACOS)
     int		i;
@@ -5395,9 +5349,7 @@
  * Need to put string in allocated memory, because do_map() will modify it.
  */
     void
-add_map(map, mode)
-    char_u	*map;
-    int		mode;
+add_map(char_u *map, int mode)
 {
     char_u	*s;
     char_u	*cpo_save = p_cpo;
diff --git a/src/gui.c b/src/gui.c
index d7ff155..d6b9eb1 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -73,7 +73,7 @@
  * recursive call.
  */
     void
-gui_start()
+gui_start(void)
 {
     char_u	*old_term;
     static int	recursive = 0;
@@ -152,7 +152,7 @@
  * full_screen will be set to TRUE again by a successful termcapinit().
  */
     static void
-gui_attempt_start()
+gui_attempt_start(void)
 {
     static int recursive = 0;
 
@@ -204,7 +204,7 @@
  * and the child will return.
  */
     static void
-gui_do_fork()
+gui_do_fork(void)
 {
     int		pipefd[2];	/* pipe between parent and child */
     int		pipe_error;
@@ -345,9 +345,7 @@
  * Call this when vim starts up, whether or not the GUI is started
  */
     void
-gui_prepare(argc, argv)
-    int	    *argc;
-    char    **argv;
+gui_prepare(int *argc, char **argv)
 {
     gui.in_use = FALSE;		    /* No GUI yet (maybe later) */
     gui.starting = FALSE;	    /* No GUI yet (maybe later) */
@@ -361,7 +359,7 @@
  * Returns FAIL or OK.
  */
     int
-gui_init_check()
+gui_init_check(void)
 {
     static int result = MAYBE;
 
@@ -461,7 +459,7 @@
  * This is the call which starts the GUI.
  */
     void
-gui_init()
+gui_init(void)
 {
     win_T	*wp;
     static int	recursive = 0;
@@ -789,8 +787,7 @@
 
 
     void
-gui_exit(rc)
-    int		rc;
+gui_exit(int rc)
 {
     /* don't free the fonts, it leads to a BUS error
      * richard@whitequeen.com Jul 99 */
@@ -809,7 +806,7 @@
  * When this function returns, Vim should NOT exit!
  */
     void
-gui_shell_closed()
+gui_shell_closed(void)
 {
     cmdmod_T	    save_cmdmod;
 
@@ -843,9 +840,7 @@
  * the fonts are unchanged.
  */
     int
-gui_init_font(font_list, fontset)
-    char_u	*font_list;
-    int		fontset UNUSED;
+gui_init_font(char_u *font_list, int fontset UNUSED)
 {
 #define FONTLEN 320
     char_u	font_name[FONTLEN];
@@ -926,8 +921,7 @@
  * Try setting 'guifontwide' to a font twice as wide as "name".
  */
     static void
-set_guifontwide(name)
-    char_u	*name;
+set_guifontwide(char_u *name)
 {
     int		i = 0;
     char_u	wide_name[FONTLEN + 10]; /* room for 2 * width and '*' */
@@ -976,7 +970,7 @@
  * Return FAIL for an invalid font name.
  */
     int
-gui_get_wide_font()
+gui_get_wide_font(void)
 {
     GuiFont	font = NOFONT;
     char_u	font_name[FONTLEN];
@@ -1024,9 +1018,7 @@
 #endif
 
     void
-gui_set_cursor(row, col)
-    int	    row;
-    int	    col;
+gui_set_cursor(int row, int col)
 {
     gui.row = row;
     gui.col = col;
@@ -1036,7 +1028,7 @@
  * gui_check_pos - check if the cursor is on the screen.
  */
     static void
-gui_check_pos()
+gui_check_pos(void)
 {
     if (gui.row >= screen_Rows)
 	gui.row = screen_Rows - 1;
@@ -1052,9 +1044,9 @@
  * otherwise this goes wrong.  May need to call out_flush() first.
  */
     void
-gui_update_cursor(force, clear_selection)
-    int		force;		/* when TRUE, update even when not moved */
-    int		clear_selection;/* clear selection under cursor */
+gui_update_cursor(
+    int		force,		/* when TRUE, update even when not moved */
+    int		clear_selection)/* clear selection under cursor */
 {
     int		cur_width = 0;
     int		cur_height = 0;
@@ -1301,7 +1293,7 @@
 
 #if defined(FEAT_MENU) || defined(PROTO)
     void
-gui_position_menu()
+gui_position_menu(void)
 {
 # if !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MOTIF)
     if (gui.menu_is_active && gui.in_use)
@@ -1315,8 +1307,7 @@
  * scrollbars are NOT handled here.  See gui_update_scrollbars().
  */
     static void
-gui_position_components(total_width)
-    int	    total_width UNUSED;
+gui_position_components(int total_width UNUSED)
 {
     int	    text_area_x;
     int	    text_area_y;
@@ -1388,7 +1379,7 @@
  * Get the width of the widgets and decorations to the side of the text area.
  */
     int
-gui_get_base_width()
+gui_get_base_width(void)
 {
     int	    base_width;
 
@@ -1404,7 +1395,7 @@
  * Get the height of the widgets and decorations above and below the text area.
  */
     int
-gui_get_base_height()
+gui_get_base_height(void)
 {
     int	    base_height;
 
@@ -1449,9 +1440,7 @@
  * the new width and height of the shell in pixels.
  */
     void
-gui_resize_shell(pixel_width, pixel_height)
-    int		pixel_width;
-    int		pixel_height;
+gui_resize_shell(int pixel_width, int pixel_height)
 {
     static int	busy = FALSE;
 
@@ -1520,7 +1509,7 @@
  * Check if gui_resize_shell() must be called.
  */
     void
-gui_may_resize_shell()
+gui_may_resize_shell(void)
 {
     int		h, w;
 
@@ -1537,7 +1526,7 @@
 }
 
     int
-gui_get_shellsize()
+gui_get_shellsize(void)
 {
     Rows = gui.num_rows;
     Columns = gui.num_cols;
@@ -1550,10 +1539,10 @@
  * on the screen.
  */
     void
-gui_set_shellsize(mustset, fit_to_display, direction)
-    int		mustset UNUSED;		/* set by the user */
-    int		fit_to_display;
-    int		direction;		/* RESIZE_HOR, RESIZE_VER */
+gui_set_shellsize(
+    int		mustset UNUSED,		/* set by the user */
+    int		fit_to_display,
+    int		direction)		/* RESIZE_HOR, RESIZE_VER */
 {
     int		base_width;
     int		base_height;
@@ -1676,7 +1665,7 @@
  * Called when Rows and/or Columns has changed.
  */
     void
-gui_new_shellsize()
+gui_new_shellsize(void)
 {
     gui_reset_scroll_region();
 }
@@ -1685,7 +1674,7 @@
  * Make scroll region cover whole screen.
  */
     void
-gui_reset_scroll_region()
+gui_reset_scroll_region(void)
 {
     gui.scroll_region_top = 0;
     gui.scroll_region_bot = gui.num_rows - 1;
@@ -1694,8 +1683,7 @@
 }
 
     void
-gui_start_highlight(mask)
-    int	    mask;
+gui_start_highlight(int mask)
 {
     if (mask > HL_ALL)		    /* highlight code */
 	gui.highlight_mask = mask;
@@ -1704,8 +1692,7 @@
 }
 
     void
-gui_stop_highlight(mask)
-    int	    mask;
+gui_stop_highlight(int mask)
 {
     if (mask > HL_ALL)		    /* highlight code */
 	gui.highlight_mask = HL_NORMAL;
@@ -1718,11 +1705,11 @@
  * (row2, col2) inclusive.
  */
     void
-gui_clear_block(row1, col1, row2, col2)
-    int	    row1;
-    int	    col1;
-    int	    row2;
-    int	    col2;
+gui_clear_block(
+    int	    row1,
+    int	    col1,
+    int	    row2,
+    int	    col2)
 {
     /* Clear the selection if we are about to write over it */
     clip_may_clear_selection(row1, row2);
@@ -1740,15 +1727,15 @@
  * output buffer before calling gui_update_cursor().
  */
     void
-gui_update_cursor_later()
+gui_update_cursor_later(void)
 {
-    OUT_STR(IF_EB("\033|s", ESC_STR "|s"));
+ OUT_STR(IF_EB("\033|s", ESC_STR "|s"));
 }
 
     void
-gui_write(s, len)
-    char_u	*s;
-    int		len;
+gui_write(
+    char_u	*s,
+    int		len)
 {
     char_u	*p;
     int		arg1 = 0, arg2 = 0;
@@ -1977,7 +1964,7 @@
  * gui_can_update_cursor() afterwards.
  */
     void
-gui_dont_update_cursor()
+gui_dont_update_cursor(void)
 {
     if (gui.in_use)
     {
@@ -1988,7 +1975,7 @@
 }
 
     void
-gui_can_update_cursor()
+gui_can_update_cursor(void)
 {
     can_update_cursor = TRUE;
     /* No need to update the cursor right now, there is always more output
@@ -1996,9 +1983,7 @@
 }
 
     static void
-gui_outstr(s, len)
-    char_u  *s;
-    int	    len;
+gui_outstr(char_u *s, int len)
 {
     int	    this_len;
 #ifdef FEAT_MBYTE
@@ -2060,11 +2045,12 @@
  * Returns FAIL or OK, just like gui_outstr_nowrap().
  */
     static int
-gui_screenchar(off, flags, fg, bg, back)
-    int		off;	    /* Offset from start of screen */
-    int		flags;
-    guicolor_T	fg, bg;	    /* colors for cursor */
-    int		back;	    /* backup this many chars when using bold trick */
+gui_screenchar(
+    int		off,	    /* Offset from start of screen */
+    int		flags,
+    guicolor_T	fg,	    /* colors for cursor */
+    guicolor_T	bg,	    /* colors for cursor */
+    int		back)	    /* backup this many chars when using bold trick */
 {
 #ifdef FEAT_MBYTE
     char_u	buf[MB_MAXBYTES + 1];
@@ -2101,12 +2087,13 @@
  * as possible to work nicely.  It's a lot faster as well.
  */
     static int
-gui_screenstr(off, len, flags, fg, bg, back)
-    int		off;	    /* Offset from start of screen */
-    int		len;	    /* string length in screen cells */
-    int		flags;
-    guicolor_T	fg, bg;	    /* colors for cursor */
-    int		back;	    /* backup this many chars when using bold trick */
+gui_screenstr(
+    int		off,	    /* Offset from start of screen */
+    int		len,	    /* string length in screen cells */
+    int		flags,
+    guicolor_T	fg,	    /* colors for cursor */
+    guicolor_T	bg,	    /* colors for cursor */
+    int		back)	    /* backup this many chars when using bold trick */
 {
     char_u  *buf;
     int	    outlen = 0;
@@ -2184,12 +2171,13 @@
  * FAIL (the caller should start drawing "back" chars back).
  */
     int
-gui_outstr_nowrap(s, len, flags, fg, bg, back)
-    char_u	*s;
-    int		len;
-    int		flags;
-    guicolor_T	fg, bg;	    /* colors for cursor */
-    int		back;	    /* backup this many chars when using bold trick */
+gui_outstr_nowrap(
+    char_u	*s,
+    int		len,
+    int		flags,
+    guicolor_T	fg,	    /* colors for cursor */
+    guicolor_T	bg,	    /* colors for cursor */
+    int		back)	    /* backup this many chars when using bold trick */
 {
     long_u	highlight_mask;
     long_u	hl_mask_todo;
@@ -2576,7 +2564,7 @@
  * position.  The character just before it too, for when it was in bold.
  */
     void
-gui_undraw_cursor()
+gui_undraw_cursor(void)
 {
     if (gui.cursor_is_valid)
     {
@@ -2617,11 +2605,11 @@
 }
 
     void
-gui_redraw(x, y, w, h)
-    int		x;
-    int		y;
-    int		w;
-    int		h;
+gui_redraw(
+    int		x,
+    int		y,
+    int		w,
+    int		h)
 {
     int		row1, col1, row2, col2;
 
@@ -2650,12 +2638,12 @@
  * different attributes (may have to be redrawn too).
  */
     int
-gui_redraw_block(row1, col1, row2, col2, flags)
-    int		row1;
-    int		col1;
-    int		row2;
-    int		col2;
-    int		flags;	/* flags for gui_outstr_nowrap() */
+gui_redraw_block(
+    int		row1,
+    int		col1,
+    int		row2,
+    int		col2,
+    int		flags)	/* flags for gui_outstr_nowrap() */
 {
     int		old_row, old_col;
     long_u	old_hl_mask;
@@ -2814,9 +2802,7 @@
 }
 
     static void
-gui_delete_lines(row, count)
-    int	    row;
-    int	    count;
+gui_delete_lines(int row, int count)
 {
     if (count <= 0)
 	return;
@@ -2844,9 +2830,7 @@
 }
 
     static void
-gui_insert_lines(row, count)
-    int	    row;
-    int	    count;
+gui_insert_lines(int row, int count)
 {
     if (count <= 0)
 	return;
@@ -2880,8 +2864,7 @@
  * or FAIL otherwise.
  */
     int
-gui_wait_for_chars(wtime)
-    long    wtime;
+gui_wait_for_chars(long wtime)
 {
     int	    retval;
 
@@ -2956,10 +2939,7 @@
  * Fill p[4] with mouse coordinates encoded for check_termcode().
  */
     static void
-fill_mouse_coord(p, col, row)
-    char_u	*p;
-    int		col;
-    int		row;
+fill_mouse_coord(char_u *p, int col, int row)
 {
     p[0] = (char_u)(col / 128 + ' ' + 1);
     p[1] = (char_u)(col % 128 + ' ' + 1);
@@ -2984,12 +2964,12 @@
  * character.
  */
     void
-gui_send_mouse_event(button, x, y, repeated_click, modifiers)
-    int	    button;
-    int	    x;
-    int	    y;
-    int	    repeated_click;
-    int_u   modifiers;
+gui_send_mouse_event(
+    int	    button,
+    int	    x,
+    int	    y,
+    int	    repeated_click,
+    int_u   modifiers)
 {
     static int	    prev_row = 0, prev_col = 0;
     static int	    prev_button = -1;
@@ -3299,10 +3279,7 @@
  * returns column in "*colp" and row as return value;
  */
     int
-gui_xy2colrow(x, y, colp)
-    int		x;
-    int		y;
-    int		*colp;
+gui_xy2colrow(int x, int y, int *colp)
 {
     int		col = check_col(X_2_COL(x));
     int		row = check_row(Y_2_ROW(y));
@@ -3320,8 +3297,7 @@
  * Callback function for when a menu entry has been selected.
  */
     void
-gui_menu_cb(menu)
-    vimmenu_T *menu;
+gui_menu_cb(vimmenu_T *menu)
 {
     char_u  bytes[sizeof(long_u)];
 
@@ -3346,8 +3322,7 @@
  * in p_go.
  */
     void
-gui_init_which_components(oldval)
-    char_u	*oldval UNUSED;
+gui_init_which_components(char_u *oldval UNUSED)
 {
 #ifdef FEAT_MENU
     static int	prev_menu_is_active = -1;
@@ -3599,7 +3574,7 @@
  * It may still be hidden if 'showtabline' is zero.
  */
     int
-gui_use_tabline()
+gui_use_tabline(void)
 {
     return gui.in_use && vim_strchr(p_go, GO_TABLINE) != NULL;
 }
@@ -3609,7 +3584,7 @@
  * This uses 'showtabline'.
  */
     static int
-gui_has_tabline()
+gui_has_tabline(void)
 {
     if (!gui_use_tabline()
 	    || p_stal == 0
@@ -3623,7 +3598,7 @@
  * This may display/undisplay the tabline and update the labels.
  */
     void
-gui_update_tabline()
+gui_update_tabline(void)
 {
     int	    showit = gui_has_tabline();
     int	    shown = gui_mch_showing_tabline();
@@ -3651,9 +3626,9 @@
  * Get the label or tooltip for tab page "tp" into NameBuff[].
  */
     void
-get_tabline_label(tp, tooltip)
-    tabpage_T	*tp;
-    int		tooltip;	/* TRUE: get tooltip */
+get_tabline_label(
+    tabpage_T	*tp,
+    int		tooltip)	/* TRUE: get tooltip */
 {
     int		modified = FALSE;
     char_u	buf[40];
@@ -3744,8 +3719,7 @@
  * that tab page or the cmdline window is open.
  */
     int
-send_tabline_event(nr)
-    int	    nr;
+send_tabline_event(int nr)
 {
     char_u string[3];
 
@@ -3777,9 +3751,7 @@
  * Send a tabline menu event
  */
     void
-send_tabline_menu_event(tabidx, event)
-    int	    tabidx;
-    int	    event;
+send_tabline_menu_event(int tabidx, int event)
 {
     char_u	    string[3];
 
@@ -3807,7 +3779,7 @@
  * Remove all scrollbars.  Used before switching to another tab page.
  */
     void
-gui_remove_scrollbars()
+gui_remove_scrollbars(void)
 {
     int	    i;
     win_T   *wp;
@@ -3829,10 +3801,7 @@
 #endif
 
     void
-gui_create_scrollbar(sb, type, wp)
-    scrollbar_T	*sb;
-    int		type;
-    win_T	*wp;
+gui_create_scrollbar(scrollbar_T *sb, int type, win_T *wp)
 {
     static int	sbar_ident = 0;
 
@@ -3858,8 +3827,7 @@
  * Find the scrollbar with the given index.
  */
     scrollbar_T *
-gui_find_scrollbar(ident)
-    long	ident;
+gui_find_scrollbar(long ident)
 {
     win_T	*wp;
 
@@ -3891,10 +3859,7 @@
  * are still characters to be processed.
  */
     void
-gui_drag_scrollbar(sb, value, still_dragging)
-    scrollbar_T	*sb;
-    long	value;
-    int		still_dragging;
+gui_drag_scrollbar(scrollbar_T *sb, long value, int still_dragging)
 {
 #ifdef FEAT_WINDOWS
     win_T	*wp;
@@ -4112,7 +4077,7 @@
  * Called when something in the window layout has changed.
  */
     void
-gui_may_update_scrollbars()
+gui_may_update_scrollbars(void)
 {
     if (gui.in_use && starting == 0)
     {
@@ -4125,8 +4090,8 @@
 #endif
 
     void
-gui_update_scrollbars(force)
-    int		force;	    /* Force all scrollbars to get updated */
+gui_update_scrollbars(
+    int		force)	    /* Force all scrollbars to get updated */
 {
     win_T	*wp;
     scrollbar_T	*sb;
@@ -4340,10 +4305,10 @@
  * sometimes.
  */
     static void
-gui_do_scrollbar(wp, which, enable)
-    win_T	*wp;
-    int		which;	    /* SBAR_LEFT or SBAR_RIGHT */
-    int		enable;	    /* TRUE to enable scrollbar */
+gui_do_scrollbar(
+    win_T	*wp,
+    int		which,	    /* SBAR_LEFT or SBAR_RIGHT */
+    int		enable)	    /* TRUE to enable scrollbar */
 {
 #ifdef FEAT_VERTSPLIT
     int		midcol = curwin->w_wincol + curwin->w_width / 2;
@@ -4386,7 +4351,7 @@
  * or FALSE otherwise.
  */
     int
-gui_do_scroll()
+gui_do_scroll(void)
 {
     win_T	*wp, *save_wp;
     int		i;
@@ -4498,8 +4463,7 @@
  * Return length of line "lnum" for horizontal scrolling.
  */
     static colnr_T
-scroll_line_len(lnum)
-    linenr_T	lnum;
+scroll_line_len(linenr_T lnum)
 {
     char_u	*p;
     colnr_T	col;
@@ -4528,7 +4492,7 @@
  * by setting 'h' in "guioptions") then the current line number is returned.
  */
     static linenr_T
-gui_find_longest_lnum()
+gui_find_longest_lnum(void)
 {
     linenr_T ret = 0;
 
@@ -4569,8 +4533,7 @@
 }
 
     static void
-gui_update_horiz_scrollbar(force)
-    int		force;
+gui_update_horiz_scrollbar(int force)
 {
     long	value, size, max;	/* need 32 bit ints here */
 
@@ -4662,9 +4625,7 @@
  * Do a horizontal scroll.  Return TRUE if the cursor moved, FALSE otherwise.
  */
     int
-gui_do_horiz_scroll(leftcol, compute_longest_lnum)
-    long_u	leftcol;
-    int		compute_longest_lnum;
+gui_do_horiz_scroll(long_u leftcol, int compute_longest_lnum)
 {
     /* no wrapping, no scrolling */
     if (curwin->w_p_wrap)
@@ -4702,7 +4663,7 @@
  * Check that none of the colors are the same as the background color
  */
     void
-gui_check_colors()
+gui_check_colors(void)
 {
     if (gui.norm_pixel == gui.back_pixel || gui.norm_pixel == INVALCOLOR)
     {
@@ -4713,16 +4674,14 @@
 }
 
     static void
-gui_set_fg_color(name)
-    char_u	*name;
+gui_set_fg_color(char_u *name)
 {
     gui.norm_pixel = gui_get_color(name);
     hl_set_fg_color_name(vim_strsave(name));
 }
 
     static void
-gui_set_bg_color(name)
-    char_u	*name;
+gui_set_bg_color(char_u *name)
 {
     gui.back_pixel = gui_get_color(name);
     hl_set_bg_color_name(vim_strsave(name));
@@ -4733,8 +4692,7 @@
  * Returns INVALCOLOR and gives an error message when failed.
  */
     guicolor_T
-gui_get_color(name)
-    char_u	*name;
+gui_get_color(char_u *name)
 {
     guicolor_T	t;
 
@@ -4755,8 +4713,7 @@
  * Return the grey value of a color (range 0-255).
  */
     int
-gui_get_lightness(pixel)
-    guicolor_T	pixel;
+gui_get_lightness(guicolor_T pixel)
 {
     long_u	rgb = gui_mch_get_rgb(pixel);
 
@@ -4767,7 +4724,7 @@
 
 #if defined(FEAT_GUI_X11) || defined(PROTO)
     void
-gui_new_scrollbar_colors()
+gui_new_scrollbar_colors(void)
 {
     win_T	*wp;
 
@@ -4788,8 +4745,7 @@
  * Call this when focus has changed.
  */
     void
-gui_focus_change(in_focus)
-    int		in_focus;
+gui_focus_change(int in_focus)
 {
 /*
  * Skip this code to avoid drawing the cursor when debugging and switching
@@ -4823,9 +4779,7 @@
  * Called when the mouse moved (but not when dragging).
  */
     void
-gui_mouse_moved(x, y)
-    int		x;
-    int		y;
+gui_mouse_moved(int x, int y)
 {
     win_T	*wp;
     char_u	st[8];
@@ -4902,7 +4856,7 @@
  * Called when mouse should be moved to window with focus.
  */
     void
-gui_mouse_correct()
+gui_mouse_correct(void)
 {
     int		x, y;
     win_T	*wp = NULL;
@@ -4935,9 +4889,7 @@
  * Find window where the mouse pointer "y" coordinate is in.
  */
     static win_T *
-xy2win(x, y)
-    int		x UNUSED;
-    int		y UNUSED;
+xy2win(int x UNUSED, int y UNUSED)
 {
 #ifdef FEAT_WINDOWS
     int		row;
@@ -4981,8 +4933,7 @@
  * File names may be given to redefine the args list.
  */
     void
-ex_gui(eap)
-    exarg_T	*eap;
+ex_gui(exarg_T *eap)
 {
     char_u	*arg = eap->arg;
 
@@ -5023,9 +4974,7 @@
  * Callback function for do_in_runtimepath().
  */
     static void
-gfp_setname(fname, cookie)
-    char_u	*fname;
-    void	*cookie;
+gfp_setname(char_u *fname, void *cookie)
 {
     char_u	*gfp_buffer = cookie;
 
@@ -5040,10 +4989,7 @@
  * Return FAIL for failure and OK if buffer[MAXPATHL] contains the result.
  */
     int
-gui_find_bitmap(name, buffer, ext)
-    char_u	*name;
-    char_u	*buffer;
-    char	*ext;
+gui_find_bitmap(char_u *name, char_u *buffer, char *ext)
 {
     if (STRLEN(name) > MAXPATHL - 14)
 	return FAIL;
@@ -5063,10 +5009,7 @@
  * contains "name".
  */
     void
-gui_find_iconfile(name, buffer, ext)
-    char_u	*name;
-    char_u	*buffer;
-    char	*ext;
+gui_find_iconfile(char_u *name, char_u *buffer, char *ext)
 {
     char_u	buf[MAXPATHL + 1];
 
@@ -5079,7 +5022,7 @@
 
 #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) || defined(PROTO)
     void
-display_errors()
+display_errors(void)
 {
     char_u	*p;
 
@@ -5111,7 +5054,7 @@
  * allow typing on stdin.
  */
     int
-no_console_input()
+no_console_input(void)
 {
     return ((!gui.in_use || gui.starting)
 # ifndef NO_CONSOLE
@@ -5128,7 +5071,7 @@
  * Update the current window and the screen.
  */
     void
-gui_update_screen()
+gui_update_screen(void)
 {
 #ifdef FEAT_CONCEAL
     linenr_T	conceal_old_cursor_line = 0;
@@ -5199,10 +5142,10 @@
  * Returns an allocated string.
  */
     char_u *
-get_find_dialog_text(arg, wwordp, mcasep)
-    char_u	*arg;
-    int		*wwordp;	/* return: TRUE if \< \> found */
-    int		*mcasep;	/* return: TRUE if \C found */
+get_find_dialog_text(
+    char_u	*arg,
+    int		*wwordp,	/* return: TRUE if \< \> found */
+    int		*mcasep)	/* return: TRUE if \C found */
 {
     char_u	*text;
 
@@ -5260,10 +5203,7 @@
  * Concatenate "text" to grow array "gap", escaping "what" with a backslash.
  */
     static void
-concat_esc(gap, text, what)
-    garray_T	*gap;
-    char_u	*text;
-    int		what;
+concat_esc(garray_T *gap, char_u *text, int what)
 {
     while (*text != NUL)
     {
@@ -5289,11 +5229,11 @@
  * Return TRUE when something was added to the input buffer.
  */
     int
-gui_do_findrepl(flags, find_text, repl_text, down)
-    int		flags;		/* one of FRD_REPLACE, FRD_FINDNEXT, etc. */
-    char_u	*find_text;
-    char_u	*repl_text;
-    int		down;		/* Search downwards. */
+gui_do_findrepl(
+    int		flags,		/* one of FRD_REPLACE, FRD_FINDNEXT, etc. */
+    char_u	*find_text,
+    char_u	*repl_text,
+    int		down)		/* Search downwards. */
 {
     garray_T	ga;
     int		i;
@@ -5422,9 +5362,7 @@
  * Jump to the window at specified point (x, y).
  */
     static void
-gui_wingoto_xy(x, y)
-    int x;
-    int y;
+gui_wingoto_xy(int x, int y)
 {
     int		row = Y_2_ROW(y);
     int		col = X_2_COL(x);
@@ -5446,12 +5384,12 @@
  * fnames after call this function.
  */
     void
-gui_handle_drop(x, y, modifiers, fnames, count)
-    int		x UNUSED;
-    int		y UNUSED;
-    int_u	modifiers;
-    char_u	**fnames;
-    int		count;
+gui_handle_drop(
+    int		x UNUSED,
+    int		y UNUSED,
+    int_u	modifiers,
+    char_u	**fnames,
+    int		count)
 {
     int		i;
     char_u	*p;
diff --git a/src/gui_at_fs.c b/src/gui_at_fs.c
index 8c540fc..3c0c992 100644
--- a/src/gui_at_fs.c
+++ b/src/gui_at_fs.c
@@ -240,8 +240,7 @@
 static int SFchdir(char *path);
 
     static int
-SFchdir(path)
-    char	*path;
+SFchdir(char *path)
 {
     int		result;
 
@@ -260,8 +259,7 @@
 static void SFfree(int i);
 
     static void
-SFfree(i)
-    int	i;
+SFfree(int i)
 {
     SFDir	*dir;
     int		j;
@@ -284,9 +282,7 @@
 static void SFstrdup(char **s1, char *s2);
 
     static void
-SFstrdup(s1, s2)
-    char	**s1;
-    char	*s2;
+SFstrdup(char **s1, char *s2)
 {
     *s1 = strcpy(XtMalloc((unsigned)(strlen(s2) + 1)), s2);
 }
@@ -294,8 +290,7 @@
 static void SFunreadableDir(SFDir *dir);
 
     static void
-SFunreadableDir(dir)
-    SFDir	*dir;
+SFunreadableDir(SFDir *dir)
 {
     char	*cannotOpen = _("<cannot open> ");
 
@@ -310,9 +305,7 @@
 static void SFreplaceText(SFDir *dir, char *str);
 
     static void
-SFreplaceText(dir, str)
-    SFDir	*dir;
-    char	*str;
+SFreplaceText(SFDir *dir, char *str)
 {
     int	len;
 
@@ -333,8 +326,7 @@
 static void SFexpand(char *str);
 
     static void
-SFexpand(str)
-    char	*str;
+SFexpand(char *str)
 {
     int		len;
     int		cmp;
@@ -390,9 +382,7 @@
 static int SFfindFile(SFDir *dir, char *str);
 
     static int
-SFfindFile(dir, str)
-    SFDir	*dir;
-    char	*str;
+SFfindFile(SFDir *dir, char *str)
 {
     int		i, last, max;
     char	*name, save;
@@ -491,7 +481,7 @@
 static void SFunselect(void);
 
     static void
-SFunselect()
+SFunselect(void)
 {
     SFDir	*dir;
 
@@ -505,8 +495,7 @@
 static int SFcompareLogins(const void *p, const void *q);
 
     static int
-SFcompareLogins(p, q)
-    const void *p, *q;
+SFcompareLogins(const void *p, *q)
 {
     return strcmp(((SFLogin *)p)->name, ((SFLogin *)q)->name);
 }
@@ -514,7 +503,7 @@
 static void SFgetHomeDirs(void);
 
     static void
-SFgetHomeDirs()
+SFgetHomeDirs(void)
 {
     struct	passwd	*pw;
     int		Alloc;
@@ -582,8 +571,7 @@
 static int SFfindHomeDir(char *begin, char *end);
 
     static int
-SFfindHomeDir(begin, end)
-    char	*begin, *end;
+SFfindHomeDir(char *begin, *end)
 {
     char	save;
     char	*theRest;
@@ -613,7 +601,7 @@
 }
 
     static void
-SFupdatePath()
+SFupdatePath(void)
 {
     static int	Alloc;
     static int	wasTwiddle = 0;
@@ -807,8 +795,7 @@
 
 #ifdef XtNinternational
     static int
-WcsLen(p)
-    wchar_t *p;
+WcsLen(wchar_t *p)
 {
     int i = 0;
     while (*p++ != 0)
@@ -818,8 +805,7 @@
 #endif
 
     static void
-SFsetText(path)
-    char	*path;
+SFsetText(char *path)
 {
     XawTextBlock	text;
 
@@ -852,19 +838,19 @@
 }
 
     static void
-SFbuttonPressList(w, n, event)
-    Widget		w UNUSED;
-    int			n UNUSED;
-    XButtonPressedEvent	*event UNUSED;
+SFbuttonPressList(
+    Widget		w UNUSED,
+    int			n UNUSED,
+    XButtonPressedEvent	*event UNUSED)
 {
     SFbuttonPressed = 1;
 }
 
     static void
-SFbuttonReleaseList(w, n, event)
-    Widget		 w;
-    int			 n;
-    XButtonReleasedEvent *event;
+SFbuttonReleaseList(
+    Widget		 w,
+    int			 n,
+    XButtonReleasedEvent *event)
 {
     SFDir	*dir;
 
@@ -885,9 +871,7 @@
 static int SFcheckDir(int n, SFDir *dir);
 
     static int
-SFcheckDir(n, dir)
-    int		n;
-    SFDir		*dir;
+SFcheckDir(int n, SFDir *dir)
 {
     struct stat	statBuf;
     int		i;
@@ -951,8 +935,7 @@
 static int SFcheckFiles(SFDir *dir);
 
     static int
-SFcheckFiles(dir)
-	SFDir	*dir;
+SFcheckFiles(SFDir *dir)
 {
     int		from, to;
     int		result;
@@ -988,9 +971,7 @@
 }
 
     static void
-SFdirModTimer(cl, id)
-    XtPointer		cl UNUSED;
-    XtIntervalId	*id UNUSED;
+SFdirModTimer(XtPointer cl UNUSED, XtIntervalId *id UNUSED)
 {
     static int		n = -1;
     static int		f = 0;
@@ -1036,8 +1017,7 @@
 /* Return a single character describing what kind of file STATBUF is.  */
 
     static char
-SFstatChar(statBuf)
-    struct stat *statBuf;
+SFstatChar(struct stat *statBuf)
 {
     if (S_ISDIR (statBuf->st_mode))
 	return '/';
@@ -1100,7 +1080,7 @@
 static void SFinitFont(void);
 
     static void
-SFinitFont()
+SFinitFont(void)
 {
     TextData	*data;
 #ifdef FEAT_XFONTSET
@@ -1151,7 +1131,7 @@
 static void SFcreateGC(void);
 
     static void
-SFcreateGC()
+SFcreateGC(void)
 {
     XGCValues	gcValues;
     XRectangle	rectangles[1];
@@ -1209,9 +1189,7 @@
 }
 
     static void
-SFclearList(n, doScroll)
-    int	n;
-    int	doScroll;
+SFclearList(int n, int doScroll)
 {
     SFDir	*dir;
 
@@ -1286,9 +1264,7 @@
 static void SFdeleteEntry(SFDir *dir, SFEntry *entry);
 
     static void
-SFdeleteEntry(dir, entry)
-    SFDir	*dir;
-    SFEntry	*entry;
+SFdeleteEntry(SFDir *dir, SFEntry *entry)
 {
     SFEntry	*e;
     SFEntry	*end;
@@ -1340,10 +1316,10 @@
 static void SFwriteStatChar(char *name, int last, struct stat *statBuf);
 
     static void
-SFwriteStatChar(name, last, statBuf)
-    char	*name;
-    int		last;
-    struct stat	*statBuf;
+SFwriteStatChar(
+    char	*name,
+    int		last,
+    struct stat	*statBuf)
 {
     name[last] = SFstatChar(statBuf);
 }
@@ -1351,9 +1327,7 @@
 static int SFstatAndCheck(SFDir *dir, SFEntry *entry);
 
     static int
-SFstatAndCheck(dir, entry)
-    SFDir	*dir;
-    SFEntry	*entry;
+SFstatAndCheck(SFDir *dir, SFEntry *entry)
 {
     struct stat	statBuf;
     char	save;
@@ -1414,11 +1388,11 @@
 
 
     static void
-SFdrawStrings(w, dir, from, to)
-    Window	w;
-    SFDir	*dir;
-    int		from;
-    int		to;
+SFdrawStrings(
+    Window	w,
+    SFDir	*dir,
+    int		from,
+    int		to)
 {
     int		i;
     SFEntry	*entry;
@@ -1501,9 +1475,7 @@
 }
 
     static void
-SFdrawList(n, doScroll)
-    int	n;
-    int	doScroll;
+SFdrawList(int n, int doScroll)
 {
     SFDir	*dir;
     Window	w;
@@ -1539,8 +1511,7 @@
 }
 
     static void
-SFdrawLists(doScroll)
-    int	doScroll;
+SFdrawLists(int doScroll)
 {
     int	i;
 
@@ -1549,8 +1520,7 @@
 }
 
     static void
-SFinvertEntry(n)
-    int		n;
+SFinvertEntry(int n)
 {
     XFillRectangle(
 	    SFdisplay,
@@ -1565,7 +1535,7 @@
 static unsigned long SFscrollTimerInterval(void);
 
     static unsigned long
-SFscrollTimerInterval()
+SFscrollTimerInterval(void)
 {
     static int	maxVal = 200;
     static int	varyDist = 50;
@@ -1594,9 +1564,7 @@
 static void SFscrollTimer(XtPointer p, XtIntervalId *id);
 
     static void
-SFscrollTimer(p, id)
-    XtPointer		p;
-    XtIntervalId	*id UNUSED;
+SFscrollTimer(XtPointer p, XtIntervalId *id UNUSED)
 {
     SFDir	*dir;
     int		save;
@@ -1646,9 +1614,7 @@
 }
 
     static int
-SFnewInvertEntry(n, event)
-    int			n;
-    XMotionEvent	*event;
+SFnewInvertEntry(int n, XMotionEvent *event)
 {
     int			x, y;
     int			nw;
@@ -1693,10 +1659,7 @@
 }
 
     static void
-SFenterList(w, n, event)
-    Widget		w UNUSED;
-    int			n;
-    XEnterWindowEvent	*event;
+SFenterList(Widget w UNUSED, int n, XEnterWindowEvent *event)
 {
     int			nw;
 
@@ -1716,10 +1679,7 @@
 }
 
     static void
-SFleaveList(w, n, event)
-    Widget	w UNUSED;
-    int		n;
-    XEvent	*event UNUSED;
+SFleaveList(Widget w UNUSED, int n, XEvent *event UNUSED)
 {
     if (SFcurrentInvert[n] != -1)
     {
@@ -1729,10 +1689,7 @@
 }
 
     static void
-SFmotionList(w, n, event)
-    Widget		w UNUSED;
-    int			n;
-    XMotionEvent	*event;
+SFmotionList(Widget w UNUSED, int n, XMotionEvent *event)
 {
     int		nw;
 
@@ -1749,10 +1706,7 @@
 }
 
     static void
-SFvFloatSliderMovedCallback(w, n, fnew)
-    Widget	w;
-    XtPointer	n;
-    XtPointer	fnew;
+SFvFloatSliderMovedCallback(Widget w, XtPointer n, XtPointer fnew)
 {
     int		nw;
 
@@ -1761,10 +1715,7 @@
 }
 
     static void
-SFvSliderMovedCallback(w, n, nw)
-    Widget	w UNUSED;
-    int		n;
-    int		nw;
+SFvSliderMovedCallback(Widget w UNUSED, int n, int nw)
 {
     int		old;
     Window	win;
@@ -1846,10 +1797,7 @@
 }
 
     static void
-SFvAreaSelectedCallback(w, n, pnew)
-    Widget	w;
-    XtPointer	n;
-    XtPointer	pnew;
+SFvAreaSelectedCallback(Widget w, XtPointer n, XtPointer pnew)
 {
     SFDir	*dir;
     int		nw = (int)(long)pnew;
@@ -1906,10 +1854,7 @@
 }
 
     static void
-SFhSliderMovedCallback(w, n, nw)
-    Widget	w UNUSED;
-    XtPointer	n;
-    XtPointer	nw;
+SFhSliderMovedCallback(Widget w UNUSED, XtPointer n, XtPointer nw)
 {
     SFDir	*dir;
     int	save;
@@ -1924,10 +1869,7 @@
 }
 
     static void
-SFhAreaSelectedCallback(w, n, pnew)
-    Widget	w;
-    XtPointer	n;
-    XtPointer	pnew;
+SFhAreaSelectedCallback(Widget w, XtPointer n, XtPointer pnew)
 {
     SFDir	*dir;
     int		nw = (int)(long)pnew;
@@ -1984,10 +1926,10 @@
 }
 
     static void
-SFpathSliderMovedCallback(w, client_data, nw)
-    Widget	w UNUSED;
-    XtPointer	client_data UNUSED;
-    XtPointer	nw;
+SFpathSliderMovedCallback(
+    Widget	w UNUSED,
+    XtPointer	client_data UNUSED,
+    XtPointer	nw)
 {
     SFDir		*dir;
     int			n;
@@ -2020,10 +1962,10 @@
 }
 
     static void
-SFpathAreaSelectedCallback(w, client_data, pnew)
-    Widget	w;
-    XtPointer	client_data UNUSED;
-    XtPointer	pnew;
+SFpathAreaSelectedCallback(
+    Widget	w,
+    XtPointer	client_data UNUSED,
+    XtPointer	pnew)
 {
     int		nw = (int)(long)pnew;
     float	f;
@@ -2071,7 +2013,7 @@
 }
 
     static Boolean
-SFworkProc()
+SFworkProc(void)
 {
     SFDir	*dir;
     SFEntry	*entry;
@@ -2100,16 +2042,14 @@
 /***************** Dir.c */
 
     static int
-SFcompareEntries(p, q)
-    const void	*p;
-    const void	*q;
+SFcompareEntries(const void *p, const void *q)
 {
-    return strcmp(((SFEntry *)p)->real, ((SFEntry *)q)->real);
+ return strcmp(((SFEntry *)p)->real, ((SFEntry *)q)->real);
 }
 
     static int
-SFgetDir(dir)
-    SFDir	*dir;
+SFgetDir(
+    SFDir	*dir)
 {
     SFEntry		*result = NULL;
     int			Alloc = 0;
@@ -2194,11 +2134,11 @@
 static void SFexposeList(Widget w, XtPointer n, XEvent *event, Boolean *cont);
 
     static void
-SFexposeList(w, n, event, cont)
-    Widget	w UNUSED;
-    XtPointer	n;
-    XEvent	*event;
-    Boolean	*cont UNUSED;
+SFexposeList(
+    Widget	w UNUSED,
+    XtPointer	n,
+    XEvent	*event,
+    Boolean	*cont UNUSED)
 {
     if ((event->type == NoExpose) || event->xexpose.count)
 	return;
@@ -2209,11 +2149,11 @@
 static void SFmodVerifyCallback(Widget w, XtPointer client_data, XEvent *event, Boolean *cont);
 
     static void
-SFmodVerifyCallback(w, client_data, event, cont)
-    Widget		w UNUSED;
-    XtPointer		client_data UNUSED;
-    XEvent		*event;
-    Boolean		*cont UNUSED;
+SFmodVerifyCallback(
+    Widget		w UNUSED,
+    XtPointer		client_data UNUSED,
+    XEvent		*event,
+    Boolean		*cont UNUSED)
 {
     char	buf[2];
 
@@ -2227,10 +2167,7 @@
 static void SFokCallback(Widget w, XtPointer cl, XtPointer cd);
 
     static void
-SFokCallback(w, cl, cd)
-    Widget	w UNUSED;
-    XtPointer	cl UNUSED;
-    XtPointer	cd UNUSED;
+SFokCallback(Widget w UNUSED, XtPointer cl UNUSED, XtPointer cd UNUSED)
 {
     SFstatus = SEL_FILE_OK;
 }
@@ -2244,10 +2181,7 @@
 static void SFcancelCallback(Widget w, XtPointer cl, XtPointer cd);
 
     static void
-SFcancelCallback(w, cl, cd)
-    Widget	w UNUSED;
-    XtPointer	cl UNUSED;
-    XtPointer	cd UNUSED;
+SFcancelCallback(Widget w UNUSED, XtPointer cl UNUSED, XtPointer cd UNUSED)
 {
     SFstatus = SEL_FILE_CANCEL;
 }
@@ -2261,11 +2195,11 @@
 static void SFdismissAction(Widget w, XEvent *event, String *params, Cardinal *num_params);
 
     static void
-SFdismissAction(w, event, params, num_params)
-    Widget	w UNUSED;
-    XEvent	*event;
-    String	*params UNUSED;
-    Cardinal	*num_params UNUSED;
+SFdismissAction(
+    Widget	w UNUSED,
+    XEvent	*event,
+    String	*params UNUSED,
+    Cardinal	*num_params UNUSED)
 {
     if (event->type == ClientMessage
 	    && (Atom)event->xclient.data.l[0] != SFwmDeleteWindow)
@@ -2284,11 +2218,11 @@
 };
 
     static void
-SFsetColors(bg, fg, scroll_bg, scroll_fg)
-    guicolor_T	bg;
-    guicolor_T	fg;
-    guicolor_T	scroll_bg;
-    guicolor_T	scroll_fg;
+SFsetColors(
+    guicolor_T	bg,
+    guicolor_T	fg,
+    guicolor_T	scroll_bg,
+    guicolor_T	scroll_fg)
 {
     if (selFileForm)
     {
@@ -2366,11 +2300,11 @@
 }
 
     static void
-SFcreateWidgets(toplevel, prompt, ok, cancel)
-    Widget	toplevel;
-    char	*prompt;
-    char	*ok;
-    char	*cancel;
+SFcreateWidgets(
+    Widget	toplevel,
+    char	*prompt,
+    char	*ok,
+    char	*cancel)
 {
     Cardinal	n;
     int		listWidth, listHeight;
@@ -2686,7 +2620,7 @@
 }
 
     static void
-SFtextChanged()
+SFtextChanged(void)
 {
 #if defined(FEAT_XFONTSET) && defined(XtNinternational)
     if ((unsigned long)_XawTextFormat((TextWidget)selFileField) == XawFmtWide)
@@ -2730,7 +2664,7 @@
 }
 
     static char *
-SFgetText()
+SFgetText(void)
 {
 #if defined(FEAT_XFONTSET) && defined(XtNinternational)
     char *buf;
@@ -2756,7 +2690,7 @@
 }
 
     static void
-SFprepareToReturn()
+SFprepareToReturn(void)
 {
     SFstatus = SEL_FILE_NULL;
     XtRemoveGrab(selFile);
@@ -2770,14 +2704,14 @@
 }
 
     char *
-vim_SelFile(toplevel, prompt, init_path, show_entry, x, y, fg, bg, scroll_fg, scroll_bg)
-    Widget	toplevel;
-    char	*prompt;
-    char	*init_path;
-    int		(*show_entry)();
-    int		x, y;
-    guicolor_T	fg, bg;
-    guicolor_T	scroll_fg, scroll_bg; /* The "Scrollbar" group colors */
+vim_SelFile(
+    Widget	toplevel,
+    char	*prompt,
+    char	*init_path,
+    int		(*show_entry)(),
+    int		x, y,
+    guicolor_T	fg, bg,
+    guicolor_T	scroll_fg, scroll_bg) /* The "Scrollbar" group colors */
 {
     static int	firstTime = 1;
     XEvent	event;
diff --git a/src/gui_at_sb.c b/src/gui_at_sb.c
index 1c9bab2..98caad5 100644
--- a/src/gui_at_sb.c
+++ b/src/gui_at_sb.c
@@ -222,7 +222,7 @@
 #define PAGE_REPEAT	250
 
     static void
-ClassInitialize()
+ClassInitialize(void)
 {
     XawInitializeWidgetSet();
     XtAddConverter( XtRString, XtROrientation, XmuCvtStringToOrientation,
@@ -232,11 +232,11 @@
 #define MARGIN(sbw) (sbw)->scrollbar.thickness + (sbw)->scrollbar.shadow_width
 
     static void
-FillArea(sbw, top, bottom, fill, draw_shadow)
-    ScrollbarWidget	sbw;
-    Position		top, bottom;
-    int			fill;
-    int			draw_shadow;
+FillArea(
+    ScrollbarWidget	sbw,
+    Position		top, bottom,
+    int			fill,
+    int			draw_shadow)
 {
     int tlen = bottom - top;	/* length of thumb in pixels */
     int sw, margin, floor;
@@ -340,8 +340,7 @@
  */
 
     static void
-PaintThumb(sbw)
-    ScrollbarWidget sbw;
+PaintThumb(ScrollbarWidget sbw)
 {
     Position	    oldtop, oldbot, newtop, newbot;
     Dimension	    margin, tzl;
@@ -374,8 +373,7 @@
 }
 
     static void
-PaintArrows(sbw)
-    ScrollbarWidget sbw;
+PaintArrows(ScrollbarWidget sbw)
 {
     XPoint	point[6];
     Dimension	thickness = sbw->scrollbar.thickness - 1;
@@ -454,8 +452,7 @@
 }
 
     static void
-Destroy(w)
-    Widget w;
+Destroy(Widget w)
 {
     ScrollbarWidget sbw = (ScrollbarWidget) w;
     if (sbw->scrollbar.timer_id != (XtIntervalId) 0)
@@ -466,8 +463,7 @@
 }
 
     static void
-CreateGC(w)
-    Widget w;
+CreateGC(Widget w)
 {
     ScrollbarWidget	sbw = (ScrollbarWidget) w;
     XGCValues		gcValues;
@@ -505,8 +501,7 @@
 }
 
     static void
-SetDimensions(sbw)
-    ScrollbarWidget sbw;
+SetDimensions(ScrollbarWidget sbw)
 {
     if (sbw->scrollbar.orientation == XtorientVertical)
     {
@@ -521,11 +516,11 @@
 }
 
     static void
-Initialize(request, new, args, num_args)
-    Widget	request UNUSED;	/* what the client asked for */
-    Widget	new;		/* what we're going to give him */
-    ArgList	args UNUSED;
-    Cardinal	*num_args UNUSED;
+Initialize(
+    Widget	request UNUSED,	/* what the client asked for */
+    Widget	new,		/* what we're going to give him */
+    ArgList	args UNUSED,
+    Cardinal	*num_args UNUSED)
 {
     ScrollbarWidget sbw = (ScrollbarWidget) new;
 
@@ -549,10 +544,10 @@
 }
 
     static void
-Realize(w, valueMask, attributes)
-    Widget w;
-    Mask *valueMask;
-    XSetWindowAttributes *attributes;
+Realize(
+    Widget w,
+    Mask *valueMask,
+    XSetWindowAttributes *attributes)
 {
     /* The Simple widget actually stuffs the value in the valuemask. */
     (*vim_scrollbarWidgetClass->core_class.superclass->core_class.realize)
@@ -560,12 +555,12 @@
 }
 
     static Boolean
-SetValues(current, request, desired, args, num_args)
-    Widget  current;	    /* what I am */
-    Widget  request UNUSED; /* what he wants me to be */
-    Widget  desired;	    /* what I will become */
-    ArgList args UNUSED;
-    Cardinal *num_args UNUSED;
+SetValues(
+    Widget  current,	    /* what I am */
+    Widget  request UNUSED, /* what he wants me to be */
+    Widget  desired,	    /* what I will become */
+    ArgList args UNUSED,
+    Cardinal *num_args UNUSED)
 {
     ScrollbarWidget	sbw = (ScrollbarWidget) current;
     ScrollbarWidget	dsbw = (ScrollbarWidget) desired;
@@ -601,8 +596,7 @@
 }
 
     static void
-Resize(w)
-    Widget w;
+Resize(Widget w)
 {
     /* ForgetGravity has taken care of background, but thumb may
      * have to move as a result of the new size. */
@@ -612,10 +606,7 @@
 
 
     static void
-Redisplay(w, event, region)
-    Widget w;
-    XEvent *event;
-    Region region;
+Redisplay(Widget w, XEvent *event, Region region)
 {
     ScrollbarWidget sbw = (ScrollbarWidget) w;
     int x, y;
@@ -650,8 +641,7 @@
 
 
     static Boolean
-CompareEvents(oldEvent, newEvent)
-    XEvent *oldEvent, *newEvent;
+CompareEvents(XEvent *oldEvent, *newEvent)
 {
 #define Check(field) if (newEvent->field != oldEvent->field) return False;
 
@@ -693,10 +683,7 @@
 };
 
     static Bool
-PeekNotifyEvent(dpy, event, args)
-    Display *dpy;
-    XEvent *event;
-    char *args;
+PeekNotifyEvent(Display *dpy, XEvent *event, char *args)
 {
     struct EventData *eventData = (struct EventData*)args;
 
@@ -706,9 +693,7 @@
 
 
     static Boolean
-LookAhead(w, event)
-    Widget w;
-    XEvent *event;
+LookAhead(Widget w, XEvent *event)
 {
     XEvent newEvent;
     struct EventData eventData;
@@ -726,10 +711,10 @@
 
 
     static void
-ExtractPosition(event, x, y, state)
-    XEvent	    *event;
-    Position	    *x, *y;	/* RETURN */
-    unsigned int    *state;	/* RETURN */
+ExtractPosition(
+    XEvent	    *event,
+    Position	    *x, *y,	/* RETURN */
+    unsigned int    *state)	/* RETURN */
 {
     switch (event->type)
     {
@@ -768,11 +753,11 @@
 }
 
     static void
-HandleThumb(w, event, params, num_params)
-    Widget w;
-    XEvent *event;
-    String *params;
-    Cardinal *num_params;
+HandleThumb(
+    Widget w,
+    XEvent *event,
+    String *params,
+    Cardinal *num_params)
 {
     Position x, y, loc;
     ScrollbarWidget sbw = (ScrollbarWidget) w;
@@ -791,9 +776,7 @@
 }
 
     static void
-RepeatNotify(client_data, idp)
-    XtPointer client_data;
-    XtIntervalId *idp UNUSED;
+RepeatNotify(XtPointer client_data, XtIntervalId *idp UNUSED)
 {
     ScrollbarWidget sbw = (ScrollbarWidget) client_data;
     int		    call_data;
@@ -833,57 +816,56 @@
  * Same as above, but for floating numbers.
  */
     static float
-FloatInRange(num, small, big)
-    float num, small, big;
+FloatInRange(float num, small, big)
 {
     return (num < small) ? small : ((num > big) ? big : num);
 }
 
     static void
-ScrollOneLineUp(w, event, params, num_params)
-    Widget	w;
-    XEvent	*event;
-    String	*params UNUSED;
-    Cardinal	*num_params UNUSED;
+ScrollOneLineUp(
+    Widget	w,
+    XEvent	*event,
+    String	*params UNUSED,
+    Cardinal	*num_params UNUSED)
 {
     ScrollSome(w, event, -ONE_LINE_DATA);
 }
 
     static void
-ScrollOneLineDown(w, event, params, num_params)
-    Widget	w;
-    XEvent	*event;
-    String	*params UNUSED;
-    Cardinal	*num_params UNUSED;
+ScrollOneLineDown(
+    Widget	w,
+    XEvent	*event,
+    String	*params UNUSED,
+    Cardinal	*num_params UNUSED)
 {
     ScrollSome(w, event, ONE_LINE_DATA);
 }
 
     static void
-ScrollPageDown(w, event, params, num_params)
-    Widget	w;
-    XEvent	*event;
-    String	*params UNUSED;
-    Cardinal	*num_params UNUSED;
+ScrollPageDown(
+    Widget	w,
+    XEvent	*event,
+    String	*params UNUSED,
+    Cardinal	*num_params UNUSED)
 {
     ScrollSome(w, event, ONE_PAGE_DATA);
 }
 
     static void
-ScrollPageUp(w, event, params, num_params)
-    Widget	w;
-    XEvent	*event;
-    String	*params UNUSED;
-    Cardinal	*num_params UNUSED;
+ScrollPageUp(
+    Widget	w,
+    XEvent	*event,
+    String	*params UNUSED,
+    Cardinal	*num_params UNUSED)
 {
     ScrollSome(w, event, -ONE_PAGE_DATA);
 }
 
     static void
-ScrollSome(w, event, call_data)
-    Widget	w;
-    XEvent	*event;
-    int		call_data;
+ScrollSome(
+    Widget	w,
+    XEvent	*event,
+    int		call_data)
 {
     ScrollbarWidget	sbw = (ScrollbarWidget) w;
 
@@ -898,11 +880,11 @@
 }
 
     static void
-NotifyScroll(w, event, params, num_params)
-    Widget	w;
-    XEvent	*event;
-    String	*params UNUSED;
-    Cardinal	*num_params UNUSED;
+NotifyScroll(
+    Widget	w,
+    XEvent	*event,
+    String	*params UNUSED,
+    Cardinal	*num_params UNUSED)
 {
     ScrollbarWidget sbw = (ScrollbarWidget) w;
     Position	    x, y, loc;
@@ -987,11 +969,11 @@
 }
 
     static void
-EndScroll(w, event, params, num_params)
-    Widget w;
-    XEvent *event UNUSED;
-    String *params UNUSED;
-    Cardinal *num_params UNUSED;
+EndScroll(
+    Widget w,
+    XEvent *event UNUSED,
+    String *params UNUSED,
+    Cardinal *num_params UNUSED)
 {
     ScrollbarWidget sbw = (ScrollbarWidget) w;
 
@@ -1002,9 +984,7 @@
 }
 
     static float
-FractionLoc(sbw, x, y)
-    ScrollbarWidget sbw;
-    int x, y;
+FractionLoc(ScrollbarWidget sbw, int x, y)
 {
     int	    margin;
     float   height, width;
@@ -1018,11 +998,11 @@
 }
 
     static void
-MoveThumb(w, event, params, num_params)
-    Widget	w;
-    XEvent	*event;
-    String	*params UNUSED;
-    Cardinal	*num_params UNUSED;
+MoveThumb(
+    Widget	w,
+    XEvent	*event,
+    String	*params UNUSED,
+    Cardinal	*num_params UNUSED)
 {
     ScrollbarWidget	sbw = (ScrollbarWidget)w;
     Position		x, y;
@@ -1063,11 +1043,11 @@
 
 
     static void
-NotifyThumb(w, event, params, num_params)
-    Widget	w;
-    XEvent	*event;
-    String	*params UNUSED;
-    Cardinal	*num_params UNUSED;
+NotifyThumb(
+    Widget	w,
+    XEvent	*event,
+    String	*params UNUSED,
+    Cardinal	*num_params UNUSED)
 {
     ScrollbarWidget sbw = (ScrollbarWidget)w;
     /* Use a union to avoid a warning for the weird conversion from float to
@@ -1089,8 +1069,7 @@
 }
 
     static void
-AllocTopShadowGC(w)
-    Widget w;
+AllocTopShadowGC(Widget w)
 {
     ScrollbarWidget sbw = (ScrollbarWidget) w;
     XtGCMask	    valuemask;
@@ -1102,8 +1081,7 @@
 }
 
     static void
-AllocBotShadowGC(w)
-    Widget w;
+AllocBotShadowGC(Widget w)
 {
     ScrollbarWidget sbw = (ScrollbarWidget) w;
     XtGCMask	    valuemask;
@@ -1115,11 +1093,11 @@
 }
 
     static void
-_Xaw3dDrawShadows(gw, event, region, out)
-    Widget  gw;
-    XEvent  *event UNUSED;
-    Region  region;
-    int	    out;
+_Xaw3dDrawShadows(
+    Widget  gw,
+    XEvent  *event UNUSED,
+    Region  region,
+    int	    out)
 {
     XPoint  pt[6];
     ScrollbarWidget sbw = (ScrollbarWidget) gw;
@@ -1187,9 +1165,7 @@
  * Set the scroll bar to the given location.
  */
     void
-vim_XawScrollbarSetThumb(w, top, shown, max)
-    Widget w;
-    double top, shown, max;
+vim_XawScrollbarSetThumb(Widget w, double top, shown, max)
 {
     ScrollbarWidget sbw = (ScrollbarWidget) w;
 
diff --git a/src/gui_athena.c b/src/gui_athena.c
index 55b5dc3..2895978 100644
--- a/src/gui_athena.c
+++ b/src/gui_athena.c
@@ -87,9 +87,9 @@
  * left or middle mouse button.
  */
     static void
-gui_athena_scroll_cb_jump(w, client_data, call_data)
-    Widget	w UNUSED;
-    XtPointer	client_data, call_data;
+gui_athena_scroll_cb_jump(
+    Widget	w UNUSED,
+    XtPointer	client_data, call_data)
 {
     scrollbar_T *sb, *sb_info;
     long	value;
@@ -122,9 +122,9 @@
  * right mouse buttons.
  */
     static void
-gui_athena_scroll_cb_scroll(w, client_data, call_data)
-    Widget	w UNUSED;
-    XtPointer	client_data, call_data;
+gui_athena_scroll_cb_scroll(
+    Widget	w UNUSED,
+    XtPointer	client_data, call_data)
 {
     scrollbar_T *sb, *sb_info;
     long	value;
@@ -228,7 +228,7 @@
  * Create all the Athena widgets necessary.
  */
     void
-gui_x11_create_widgets()
+gui_x11_create_widgets(void)
 {
     /*
      * We don't have any borders handled internally by the textArea to worry
@@ -325,8 +325,7 @@
  * Calculates the Pixmap based on the size of the current menu font.
  */
     static Pixmap
-gui_athena_create_pullright_pixmap(w)
-    Widget  w;
+gui_athena_create_pullright_pixmap(Widget w)
 {
     Pixmap  retval;
 #ifdef FONTSET_ALWAYS
@@ -425,7 +424,7 @@
  * Called when the GUI is not going to start after all.
  */
     void
-gui_x11_destroy_widgets()
+gui_x11_destroy_widgets(void)
 {
     textArea = NULL;
 #ifdef FEAT_MENU
@@ -450,9 +449,7 @@
  * Return in "sen".
  */
     static void
-get_toolbar_pixmap(menu, sen)
-    vimmenu_T	*menu;
-    Pixmap	*sen;
+get_toolbar_pixmap(vimmenu_T *menu, Pixmap *sen)
 {
     char_u	buf[MAXPATHL];		/* buffer storing expanded pathname */
     char	**xpm = NULL;		/* xpm array */
@@ -492,10 +489,7 @@
  * insensitive Pixmap too.
  */
     static void
-createXpmImages(path, xpm, sen)
-    char_u	*path;
-    char	**xpm;
-    Pixmap	*sen;
+createXpmImages(char_u *path, char **xpm, Pixmap *sen)
 {
     Window	rootWindow;
     XpmAttributes attrs;
@@ -566,11 +560,11 @@
 }
 
     void
-gui_mch_set_toolbar_pos(x, y, w, h)
-    int	    x;
-    int	    y;
-    int	    w;
-    int	    h;
+gui_mch_set_toolbar_pos(
+    int	    x,
+    int	    y,
+    int	    w,
+    int	    h)
 {
     Dimension	border;
     int		height;
@@ -595,11 +589,11 @@
 #endif
 
     void
-gui_mch_set_text_area_pos(x, y, w, h)
-    int	    x;
-    int	    y;
-    int	    w;
-    int	    h;
+gui_mch_set_text_area_pos(
+    int	    x,
+    int	    y,
+    int	    w,
+    int	    h)
 {
     XtUnmanageChild(textArea);
     XtVaSetValues(textArea,
@@ -622,7 +616,7 @@
  * input go to the editor window, not the button
  */
     static void
-gui_mch_reset_focus()
+gui_mch_reset_focus(void)
 {
     XtSetKeyboardFocus(vimForm, textArea);
 }
@@ -630,7 +624,7 @@
 
 
     void
-gui_x11_set_back_color()
+gui_x11_set_back_color(void)
 {
     if (textArea != NULL)
 	XtVaSetValues(textArea,
@@ -652,8 +646,7 @@
 static Boolean	gui_athena_menu_has_submenus(Widget, Widget);
 
     void
-gui_mch_enable_menu(flag)
-    int	    flag;
+gui_mch_enable_menu(int flag)
 {
     if (flag)
     {
@@ -685,11 +678,11 @@
 }
 
     void
-gui_mch_set_menu_pos(x, y, w, h)
-    int	    x;
-    int	    y;
-    int	    w;
-    int	    h;
+gui_mch_set_menu_pos(
+    int	    x,
+    int	    y,
+    int	    w,
+    int	    h)
 {
     Dimension	border;
     int		height;
@@ -717,8 +710,7 @@
  *				    numChildren (end of children).
  */
     static Cardinal
-athena_calculate_ins_pos(widget)
-    Widget	widget;
+athena_calculate_ins_pos(Widget widget)
 {
     /* Assume that if the parent of the vimmenu_T is NULL, then we can get
      * to this menu by traversing "next", starting at "root_menu".
@@ -764,9 +756,7 @@
 }
 
     void
-gui_mch_add_menu(menu, idx)
-    vimmenu_T	*menu;
-    int		idx UNUSED;
+gui_mch_add_menu(vimmenu_T *menu, int idx UNUSED)
 {
     char_u	*pullright_name;
     Dimension	height, space, border;
@@ -884,9 +874,7 @@
  * Ignore widget "ignore" in the pane.
  */
     static Boolean
-gui_athena_menu_has_submenus(id, ignore)
-    Widget	id;
-    Widget	ignore;
+gui_athena_menu_has_submenus(Widget id, Widget ignore)
 {
     WidgetList	children;
     Cardinal	num_children;
@@ -906,8 +894,7 @@
 }
 
     static void
-gui_athena_menu_font(id)
-    Widget	id;
+gui_athena_menu_font(Widget id)
 {
 #ifdef FONTSET_ALWAYS
     if (gui.menu_fontset != NOFONTSET)
@@ -954,7 +941,7 @@
 
 
     void
-gui_mch_new_menu_font()
+gui_mch_new_menu_font(void)
 {
     Pixmap oldpuller = None;
 
@@ -1031,7 +1018,7 @@
 
 #if defined(FEAT_BEVAL) || defined(PROTO)
     void
-gui_mch_new_tooltip_font()
+gui_mch_new_tooltip_font(void)
 {
 #  ifdef FEAT_TOOLBAR
     vimmenu_T   *menu;
@@ -1046,7 +1033,7 @@
 }
 
     void
-gui_mch_new_tooltip_colors()
+gui_mch_new_tooltip_colors(void)
 {
 # ifdef FEAT_TOOLBAR
     vimmenu_T   *menu;
@@ -1062,9 +1049,9 @@
 #endif
 
     static void
-gui_mch_submenu_change(menu, colors)
-    vimmenu_T	*menu;
-    int		colors;		/* TRUE for colors, FALSE for font */
+gui_mch_submenu_change(
+    vimmenu_T	*menu,
+    int		colors)		/* TRUE for colors, FALSE for font */
 {
     vimmenu_T	*mp;
 
@@ -1141,8 +1128,7 @@
  * Replace '.' by '_', can't include '.' in the submenu name.
  */
     static char_u *
-make_pull_name(name)
-    char_u * name;
+make_pull_name(char_u * name)
 {
     char_u  *pname;
     char_u  *p;
@@ -1158,9 +1144,7 @@
 }
 
     void
-gui_mch_add_menu_item(menu, idx)
-    vimmenu_T	*menu;
-    int		idx UNUSED;
+gui_mch_add_menu_item(vimmenu_T *menu, int idx UNUSED)
 {
     vimmenu_T	*parent = menu->parent;
 
@@ -1404,7 +1388,7 @@
 
 
     int
-gui_mch_compute_toolbar_height()
+gui_mch_compute_toolbar_height(void)
 {
     Dimension	height;		    /* total Toolbar height */
     Dimension	whgt;		    /* height of each widget */
@@ -1439,12 +1423,12 @@
 }
 
     void
-gui_mch_get_toolbar_colors(bgp, fgp, bsp, tsp, hsp)
-    Pixel	*bgp;
-    Pixel	*fgp;
-    Pixel       *bsp;
-    Pixel	*tsp;
-    Pixel	*hsp;
+gui_mch_get_toolbar_colors(
+    Pixel	*bgp,
+    Pixel	*fgp,
+    Pixel       *bsp,
+    Pixel	*tsp,
+    Pixel	*hsp)
 {
     XtVaGetValues(toolBar, XtNbackground, bgp, XtNborderColor, fgp, NULL);
     *bsp = *bgp;
@@ -1455,14 +1439,13 @@
 
 
     void
-gui_mch_toggle_tearoffs(enable)
-    int		enable UNUSED;
+gui_mch_toggle_tearoffs(int enable UNUSED)
 {
     /* no tearoff menus */
 }
 
     void
-gui_mch_new_menu_colors()
+gui_mch_new_menu_colors(void)
 {
     if (menuBar == (Widget)0)
 	return;
@@ -1480,8 +1463,7 @@
  * Destroy the machine specific menu widget.
  */
     void
-gui_mch_destroy_menu(menu)
-    vimmenu_T *menu;
+gui_mch_destroy_menu(vimmenu_T *menu)
 {
     Widget	parent;
 
@@ -1626,9 +1608,9 @@
 }
 
     static void
-gui_athena_menu_timeout(client_data, id)
-    XtPointer	    client_data;
-    XtIntervalId    *id UNUSED;
+gui_athena_menu_timeout(
+    XtPointer	    client_data,
+    XtIntervalId    *id UNUSED)
 {
     Widget  w = (Widget)client_data;
     Widget  popup;
@@ -1658,10 +1640,10 @@
  * This is called when XtPopup() is called.
  */
     static void
-gui_athena_popup_callback(w, client_data, call_data)
-    Widget	w;
-    XtPointer	client_data;
-    XtPointer	call_data UNUSED;
+gui_athena_popup_callback(
+    Widget	w,
+    XtPointer	client_data,
+    XtPointer	call_data UNUSED)
 {
     /* Assumption: XtIsSubclass(XtParent(w),simpleMenuWidgetClass) */
     vimmenu_T	*menu = (vimmenu_T *)client_data;
@@ -1690,11 +1672,11 @@
 }
 
     static void
-gui_athena_popdown_submenus_action(w, event, args, nargs)
-    Widget	w;
-    XEvent	*event;
-    String	*args;
-    Cardinal	*nargs;
+gui_athena_popdown_submenus_action(
+    Widget	w,
+    XEvent	*event,
+    String	*args,
+    Cardinal	*nargs)
 {
     WidgetList	children;
     Cardinal	num_children;
@@ -1719,8 +1701,7 @@
 
 /* Used to determine if the given widget has a submenu that can be popped up. */
     static Boolean
-has_submenu(widget)
-    Widget  widget;
+has_submenu(Widget widget)
 {
     if ((widget != NULL) && XtIsSubclass(widget,smeBSBObjectClass))
     {
@@ -1734,11 +1715,11 @@
 }
 
     static void
-gui_athena_delayed_arm_action(w, event, args, nargs)
-    Widget	w;
-    XEvent	*event;
-    String	*args;
-    Cardinal	*nargs;
+gui_athena_delayed_arm_action(
+    Widget	w,
+    XEvent	*event,
+    String	*args,
+    Cardinal	*nargs)
 {
     Dimension	width, height;
 
@@ -1778,8 +1759,7 @@
 }
 
     static Widget
-get_popup_entry(w)
-    Widget  w;
+get_popup_entry(Widget w)
 {
     Widget	menuw;
 
@@ -1794,8 +1774,7 @@
  * that is to be popped up.
  */
     static Widget
-submenu_widget(widget)
-    Widget  widget;
+submenu_widget(Widget widget)
 {
     /* Precondition: has_submenu(widget) == True
      *	    XtIsSubclass(XtParent(widget),simpleMenuWidgetClass) == True
@@ -1814,8 +1793,7 @@
 }
 
     void
-gui_mch_show_popupmenu(menu)
-    vimmenu_T *menu;
+gui_mch_show_popupmenu(vimmenu_T *menu)
 {
     int		rootx, rooty, winx, winy;
     Window	root, child;
@@ -1850,7 +1828,7 @@
  * Set the menu and scrollbar colors to their default values.
  */
     void
-gui_mch_def_colors()
+gui_mch_def_colors(void)
 {
     /*
      * Get the colors ourselves.  Using the automatic conversion doesn't
@@ -1875,11 +1853,11 @@
  */
 
     void
-gui_mch_set_scrollbar_thumb(sb, val, size, max)
-    scrollbar_T	*sb;
-    long	val;
-    long	size;
-    long	max;
+gui_mch_set_scrollbar_thumb(
+    scrollbar_T	*sb,
+    long	val,
+    long	size,
+    long	max)
 {
     double	v, s;
 
@@ -1911,12 +1889,12 @@
 }
 
     void
-gui_mch_set_scrollbar_pos(sb, x, y, w, h)
-    scrollbar_T *sb;
-    int		x;
-    int		y;
-    int		w;
-    int		h;
+gui_mch_set_scrollbar_pos(
+    scrollbar_T *sb,
+    int		x,
+    int		y,
+    int		w,
+    int		h)
 {
     if (sb->id == (Widget)0)
 	return;
@@ -1932,9 +1910,7 @@
 }
 
     void
-gui_mch_enable_scrollbar(sb, flag)
-    scrollbar_T	*sb;
-    int		flag;
+gui_mch_enable_scrollbar(scrollbar_T *sb, int flag)
 {
     if (sb->id != (Widget)0)
     {
@@ -1946,9 +1922,9 @@
 }
 
     void
-gui_mch_create_scrollbar(sb, orient)
-    scrollbar_T *sb;
-    int		orient;	/* SBAR_VERT or SBAR_HORIZ */
+gui_mch_create_scrollbar(
+    scrollbar_T *sb,
+    int		orient)	/* SBAR_VERT or SBAR_HORIZ */
 {
     sb->id = XtVaCreateWidget("scrollBar",
 #ifdef FEAT_GUI_NEXTAW
@@ -1984,8 +1960,7 @@
 
 #if defined(FEAT_WINDOWS) || defined(PROTO)
     void
-gui_mch_destroy_scrollbar(sb)
-    scrollbar_T *sb;
+gui_mch_destroy_scrollbar(scrollbar_T *sb)
 {
     if (sb->id != (Widget)0)
 	XtDestroyWidget(sb->id);
@@ -1993,8 +1968,7 @@
 #endif
 
     void
-gui_mch_set_scrollbar_colors(sb)
-    scrollbar_T *sb;
+gui_mch_set_scrollbar_colors(scrollbar_T *sb)
 {
     if (sb->id != (Widget)0)
 	XtVaSetValues(sb->id,
@@ -2011,7 +1985,7 @@
  * Miscellaneous stuff:
  */
     Window
-gui_x11_get_wid()
+gui_x11_get_wid(void)
 {
     return XtWindow(textArea);
 }
@@ -2022,13 +1996,13 @@
  * Returns the selected name in allocated memory, or NULL for Cancel.
  */
     char_u *
-gui_mch_browse(saving, title, dflt, ext, initdir, filter)
-    int		saving UNUSED;	/* select file to write */
-    char_u	*title;		/* title for the window */
-    char_u	*dflt;		/* default name */
-    char_u	*ext UNUSED;	/* extension added */
-    char_u	*initdir;	/* initial directory, NULL for current dir */
-    char_u	*filter UNUSED;	/* file name filter */
+gui_mch_browse(
+    int		saving UNUSED,	/* select file to write */
+    char_u	*title,		/* title for the window */
+    char_u	*dflt,		/* default name */
+    char_u	*ext UNUSED,	/* extension added */
+    char_u	*initdir,	/* initial directory, NULL for current dir */
+    char_u	*filter UNUSED)	/* file name filter */
 {
     Position x, y;
     char_u	dirbuf[MAXPATHL];
@@ -2075,11 +2049,11 @@
  * hitting the "OK" button, ESC like "Cancel".
  */
     static void
-keyhit_callback(w, client_data, event, cont)
-    Widget		w UNUSED;
-    XtPointer		client_data UNUSED;
-    XEvent		*event;
-    Boolean		*cont UNUSED;
+keyhit_callback(
+    Widget		w UNUSED,
+    XtPointer		client_data UNUSED,
+    XEvent		*event,
+    Boolean		*cont UNUSED)
 {
     char	buf[2];
 
@@ -2093,10 +2067,10 @@
 }
 
     static void
-butproc(w, client_data, call_data)
-    Widget	w UNUSED;
-    XtPointer	client_data;
-    XtPointer	call_data UNUSED;
+butproc(
+    Widget	w UNUSED,
+    XtPointer	client_data,
+    XtPointer	call_data UNUSED)
 {
     dialogStatus = (int)(long)client_data + 1;
 }
@@ -2105,11 +2079,11 @@
  * Function called when dialog window closed.
  */
     static void
-dialog_wm_handler(w, client_data, event, dum)
-    Widget	w UNUSED;
-    XtPointer	client_data UNUSED;
-    XEvent	*event;
-    Boolean	*dum UNUSED;
+dialog_wm_handler(
+    Widget	w UNUSED,
+    XtPointer	client_data UNUSED,
+    XEvent	*event,
+    Boolean	*dum UNUSED)
 {
     if (event->type == ClientMessage
 	    && (Atom)((XClientMessageEvent *)event)->data.l[0] == dialogatom)
@@ -2117,14 +2091,14 @@
 }
 
     int
-gui_mch_dialog(type, title, message, buttons, dfltbutton, textfield, ex_cmd)
-    int		type UNUSED;
-    char_u	*title;
-    char_u	*message;
-    char_u	*buttons;
-    int		dfltbutton UNUSED;
-    char_u	*textfield;
-    int		ex_cmd UNUSED;
+gui_mch_dialog(
+    int		type UNUSED,
+    char_u	*title,
+    char_u	*message,
+    char_u	*buttons,
+    int		dfltbutton UNUSED,
+    char_u	*textfield,
+    int		ex_cmd UNUSED)
 {
     char_u		*buts;
     char_u		*p, *next;
@@ -2305,8 +2279,7 @@
  * Set the colors of Widget "id" to the menu colors.
  */
     static void
-gui_athena_menu_colors(id)
-    Widget  id;
+gui_athena_menu_colors(Widget id)
 {
     if (gui.menu_bg_pixel != INVALCOLOR)
 	XtVaSetValues(id, XtNbackground, gui.menu_bg_pixel, NULL);
@@ -2319,8 +2292,7 @@
  * Set the colors of Widget "id" to the scroll colors.
  */
     static void
-gui_athena_scroll_colors(id)
-    Widget  id;
+gui_athena_scroll_colors(Widget id)
 {
     if (gui.scroll_bg_pixel != INVALCOLOR)
 	XtVaSetValues(id, XtNbackground, gui.scroll_bg_pixel, NULL);
diff --git a/src/gui_beval.c b/src/gui_beval.c
index f177fff..e96e67d 100644
--- a/src/gui_beval.c
+++ b/src/gui_beval.c
@@ -16,9 +16,7 @@
  * Common code, invoked when the mouse is resting for a moment.
  */
     void
-general_beval_cb(beval, state)
-    BalloonEval *beval;
-    int		state UNUSED;
+general_beval_cb(BalloonEval *beval, int state UNUSED)
 {
 #ifdef FEAT_EVAL
     win_T	*wp;
@@ -192,11 +190,11 @@
  * Returns a pointer to the resulting object (NULL when out of memory).
  */
     BalloonEval *
-gui_mch_create_beval_area(target, mesg, mesgCB, clientData)
-    void	*target;
-    char_u	*mesg;
-    void	(*mesgCB)(BalloonEval *, int);
-    void	*clientData;
+gui_mch_create_beval_area(
+    void	*target,
+    char_u	*mesg,
+    void	(*mesgCB)(BalloonEval *, int),
+    void	*clientData)
 {
 #ifndef FEAT_GUI_GTK
     char	*display_name;	    /* get from gui.dpy */
@@ -262,8 +260,7 @@
  * Destroy a balloon-eval and free its associated memory.
  */
     void
-gui_mch_destroy_beval_area(beval)
-    BalloonEval	*beval;
+gui_mch_destroy_beval_area(BalloonEval *beval)
 {
     cancelBalloon(beval);
     removeEventHandler(beval);
@@ -278,16 +275,14 @@
 #endif
 
     void
-gui_mch_enable_beval_area(beval)
-    BalloonEval	*beval;
+gui_mch_enable_beval_area(BalloonEval *beval)
 {
     if (beval != NULL)
 	addEventHandler(beval->target, beval);
 }
 
     void
-gui_mch_disable_beval_area(beval)
-    BalloonEval	*beval;
+gui_mch_disable_beval_area(BalloonEval *beval)
 {
     if (beval != NULL)
 	removeEventHandler(beval);
@@ -301,7 +296,7 @@
  * Assumption: Only one tooltip can be shown at a time.
  */
     BalloonEval *
-gui_mch_currently_showing_beval()
+gui_mch_currently_showing_beval(void)
 {
     return current_beval;
 }
@@ -317,13 +312,13 @@
  * Returns OK or FAIL.
  */
     int
-get_beval_info(beval, getword, winp, lnump, textp, colp)
-    BalloonEval	*beval;
-    int		getword;
-    win_T	**winp;
-    linenr_T	*lnump;
-    char_u	**textp;
-    int		*colp;
+get_beval_info(
+    BalloonEval	*beval,
+    int		getword,
+    win_T	**winp,
+    linenr_T	*lnump,
+    char_u	**textp,
+    int		*colp)
 {
     win_T	*wp;
     int		row, col;
@@ -427,9 +422,7 @@
  * Show a balloon with "mesg".
  */
     void
-gui_mch_post_balloon(beval, mesg)
-    BalloonEval	*beval;
-    char_u	*mesg;
+gui_mch_post_balloon(BalloonEval *beval, char_u *mesg)
 {
     beval->msg = mesg;
     if (mesg != NULL)
@@ -446,8 +439,7 @@
  * Hide the given balloon.
  */
     void
-gui_mch_unpost_balloon(beval)
-    BalloonEval	*beval;
+gui_mch_unpost_balloon(BalloonEval *beval)
 {
     undrawBalloon(beval);
 }
@@ -687,9 +679,7 @@
 #else /* !FEAT_GUI_GTK */
 
     static void
-addEventHandler(target, beval)
-    Widget	target;
-    BalloonEval	*beval;
+addEventHandler(Widget target, BalloonEval *beval)
 {
     XtAddEventHandler(target,
 			PointerMotionMask | EnterWindowMask |
@@ -700,8 +690,7 @@
 }
 
     static void
-removeEventHandler(beval)
-    BalloonEval	*beval;
+removeEventHandler(BalloonEval *beval)
 {
     XtRemoveEventHandler(beval->target,
 			PointerMotionMask | EnterWindowMask |
@@ -716,11 +705,11 @@
  * The X event handler. All it does is call the real event handler.
  */
     static void
-pointerEventEH(w, client_data, event, unused)
-    Widget	w UNUSED;
-    XtPointer	client_data;
-    XEvent	*event;
-    Boolean	*unused UNUSED;
+pointerEventEH(
+    Widget	w UNUSED,
+    XtPointer	client_data,
+    XEvent	*event,
+    Boolean	*unused UNUSED)
 {
     BalloonEval *beval = (BalloonEval *)client_data;
     pointerEvent(beval, event);
@@ -733,9 +722,7 @@
  */
 
     static void
-pointerEvent(beval, event)
-    BalloonEval	*beval;
-    XEvent	*event;
+pointerEvent(BalloonEval *beval, XEvent *event)
 {
     Position	distance;	    /* a measure of how much the pointer moved */
     Position	delta;		    /* used to compute distance */
@@ -866,9 +853,7 @@
 }
 
     static void
-timerRoutine(dx, id)
-    XtPointer	    dx;
-    XtIntervalId    *id UNUSED;
+timerRoutine(XtPointer dx, XtIntervalId *id UNUSED)
 {
     BalloonEval *beval = (BalloonEval *)dx;
 
@@ -885,8 +870,7 @@
 #endif /* !FEAT_GUI_GTK */
 
     static void
-requestBalloon(beval)
-    BalloonEval	*beval;
+requestBalloon(BalloonEval *beval)
 {
     if (beval->showState != ShS_PENDING)
     {
@@ -1177,8 +1161,7 @@
  * Draw a balloon.
  */
     static void
-drawBalloon(beval)
-    BalloonEval	*beval;
+drawBalloon(BalloonEval *beval)
 {
     Dimension	w;
     Dimension	h;
@@ -1281,8 +1264,7 @@
  * Undraw a balloon.
  */
     static void
-undrawBalloon(beval)
-    BalloonEval *beval;
+undrawBalloon(BalloonEval *beval)
 {
     if (beval->balloonShell != (Widget)0)
 	XtPopdown(beval->balloonShell);
@@ -1292,8 +1274,7 @@
 }
 
     static void
-cancelBalloon(beval)
-    BalloonEval	*beval;
+cancelBalloon(BalloonEval *beval)
 {
     if (beval->showState == ShS_SHOWING
 	    || beval->showState == ShS_UPDATE_PENDING)
@@ -1309,8 +1290,7 @@
 
 
     static void
-createBalloonEvalWindow(beval)
-    BalloonEval	*beval;
+createBalloonEvalWindow(BalloonEval *beval)
 {
     Arg		args[12];
     int		n;
diff --git a/src/gui_gtk.c b/src/gui_gtk.c
index b5da5c3..99e4d70 100644
--- a/src/gui_gtk.c
+++ b/src/gui_gtk.c
@@ -1988,8 +1988,7 @@
  * ":helpfind"
  */
     void
-ex_helpfind(eap)
-    exarg_T	*eap UNUSED;
+ex_helpfind(exarg_T *eap UNUSED)
 {
     /* This will fail when menus are not loaded.  Well, it's only for
      * backwards compatibility anyway. */
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 8a718ac..ffac20e 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -571,7 +571,7 @@
 
 #if defined(EXITFREE) || defined(PROTO)
     void
-gui_mch_free_all()
+gui_mch_free_all(void)
 {
     vim_free(gui_argv);
 #if defined(FEAT_GUI_GNOME) && defined(FEAT_SESSION)
@@ -2224,10 +2224,10 @@
  * GTK tells us that XSMP needs attention
  */
     static gboolean
-local_xsmp_handle_requests(source, condition, data)
-    GIOChannel		*source UNUSED;
-    GIOCondition	condition;
-    gpointer		data;
+local_xsmp_handle_requests(
+    GIOChannel		*source UNUSED,
+    GIOCondition	condition,
+    gpointer		data)
 {
     if (condition == G_IO_IN)
     {
@@ -3070,8 +3070,7 @@
  * Set the current tab to "nr".  First tab is 1.
  */
     void
-gui_mch_set_curtab(nr)
-    int		nr;
+gui_mch_set_curtab(int nr)
 {
     if (gui.tabline == NULL)
 	return;
@@ -3944,7 +3943,7 @@
  * Return TRUE if the main window is maximized.
  */
     int
-gui_mch_maximized()
+gui_mch_maximized(void)
 {
     return (gui.mainwin != NULL && gui.mainwin->window != NULL
 	    && (gdk_window_get_state(gui.mainwin->window)
@@ -3955,7 +3954,7 @@
  * Unmaximize the main window
  */
     void
-gui_mch_unmaximize()
+gui_mch_unmaximize(void)
 {
     if (gui.mainwin != NULL)
 	gtk_window_unmaximize(GTK_WINDOW(gui.mainwin));
@@ -3966,7 +3965,7 @@
  * new Rows and Columns.  This is like resizing the window.
  */
     void
-gui_mch_newfont()
+gui_mch_newfont(void)
 {
     int w, h;
 
diff --git a/src/gui_mac.c b/src/gui_mac.c
index 3479dbb..c766ed0 100644
--- a/src/gui_mac.c
+++ b/src/gui_mac.c
@@ -2607,8 +2607,7 @@
  * the menu that we should display
  */
     void
-gui_mac_handle_contextual_menu(event)
-    EventRecord *event;
+gui_mac_handle_contextual_menu(EventRecord *event)
 {
 /*
  *  Clone PopUp to use menu
@@ -3697,8 +3696,7 @@
  * If a font is not going to be used, free its structure.
  */
     void
-gui_mch_free_font(font)
-    GuiFont	font;
+gui_mch_free_font(GuiFont font)
 {
     /*
      * Free font when "font" is not 0.
@@ -6897,8 +6895,7 @@
  * Set the current tab to "nr".  First tab is 1.
  */
     void
-gui_mch_set_curtab(nr)
-    int		nr;
+gui_mch_set_curtab(int nr)
 {
     DataBrowserItemID item = nr;
     SetDataBrowserSelectedItems(dataBrowser, 1, &item, kDataBrowserItemsAssign);
diff --git a/src/gui_motif.c b/src/gui_motif.c
index 2f64f4d..72a2915 100644
--- a/src/gui_motif.c
+++ b/src/gui_motif.c
@@ -118,9 +118,7 @@
  */
 
     static void
-scroll_cb(w, client_data, call_data)
-    Widget	w UNUSED;
-    XtPointer	client_data, call_data;
+scroll_cb(Widget w UNUSED, XtPointer client_data, call_data)
 {
     scrollbar_T *sb;
     long	value;
@@ -136,10 +134,10 @@
 
 #ifdef FEAT_GUI_TABLINE
     static void
-tabline_cb(w, client_data, call_data)
-    Widget	w UNUSED;
-    XtPointer	client_data UNUSED;
-    XtPointer	call_data;
+tabline_cb(
+    Widget	w UNUSED,
+    XtPointer	client_data UNUSED,
+    XtPointer	call_data)
 {
     XmNotebookCallbackStruct *nptr;
 
@@ -149,10 +147,10 @@
 }
 
     static void
-tabline_button_cb(w, client_data, call_data)
-    Widget	w;
-    XtPointer	client_data UNUSED;
-    XtPointer	call_data UNUSED;
+tabline_button_cb(
+    Widget	w,
+    XtPointer	client_data UNUSED,
+    XtPointer	call_data UNUSED)
 {
     int		cmd, tab_idx;
 
@@ -166,9 +164,9 @@
  * Tabline single mouse click timeout handler
  */
     static void
-motif_tabline_timer_cb (timed_out, interval_id)
-    XtPointer		timed_out;
-    XtIntervalId	*interval_id UNUSED;
+motif_tabline_timer_cb (
+    XtPointer		timed_out,
+    XtIntervalId	*interval_id UNUSED)
 {
     *((int *)timed_out) = TRUE;
 }
@@ -177,9 +175,9 @@
  * check if the tabline tab scroller is clicked
  */
     static int
-tabline_scroller_clicked(scroller_name, event)
-    char		*scroller_name;
-    XButtonPressedEvent *event;
+tabline_scroller_clicked(
+    char		*scroller_name,
+    XButtonPressedEvent *event)
 {
     Widget	tab_scroll_w;
     Position	pos_x, pos_y;
@@ -202,11 +200,11 @@
 }
 
     static void
-tabline_menu_cb(w, closure, e, continue_dispatch)
-    Widget	w;
-    XtPointer	closure UNUSED;
-    XEvent	*e;
-    Boolean	*continue_dispatch UNUSED;
+tabline_menu_cb(
+    Widget	w,
+    XtPointer	closure UNUSED,
+    XEvent	*e,
+    Boolean	*continue_dispatch UNUSED)
 {
     Widget			tab_w;
     XButtonPressedEvent		*event;
@@ -275,9 +273,7 @@
 }
 
     static void
-tabline_balloon_cb(beval, state)
-    BalloonEval	*beval;
-    int		state UNUSED;
+tabline_balloon_cb(BalloonEval *beval, int state UNUSED)
 {
     int		nr;
     tabpage_T	*tp;
@@ -313,10 +309,7 @@
 static void label_expose(Widget _w, XEvent *_event, Region _region);
 
     static void
-label_expose(_w, _event, _region)
-    Widget	_w;
-    XEvent	*_event;
-    Region	_region;
+label_expose(Widget _w, XEvent *_event, Region _region)
 {
     GC		    insensitiveGC;
     XmLabelWidget   lw = (XmLabelWidget)_w;
@@ -396,7 +389,7 @@
  * Create all the motif widgets necessary.
  */
     void
-gui_x11_create_widgets()
+gui_x11_create_widgets(void)
 {
 #ifdef FEAT_GUI_TABLINE
     Widget	button, scroller;
@@ -633,7 +626,7 @@
  * Called when the GUI is not going to start after all.
  */
     void
-gui_x11_destroy_widgets()
+gui_x11_destroy_widgets(void)
 {
     textArea = NULL;
 #ifdef FEAT_MENU
@@ -642,11 +635,11 @@
 }
 
     void
-gui_mch_set_text_area_pos(x, y, w, h)
-    int	    x UNUSED;
-    int	    y UNUSED;
-    int	    w UNUSED;
-    int	    h UNUSED;
+gui_mch_set_text_area_pos(
+    int	    x UNUSED,
+    int	    y UNUSED,
+    int	    w UNUSED,
+    int	    h UNUSED)
 {
 #ifdef FEAT_TOOLBAR
     /* Give keyboard focus to the textArea instead of the toolbar. */
@@ -655,7 +648,7 @@
 }
 
     void
-gui_x11_set_back_color()
+gui_x11_set_back_color(void)
 {
     if (textArea != NULL)
 #if (XmVersion >= 1002)
@@ -672,8 +665,7 @@
  * well.
  */
     void
-manage_centered(dialog_child)
-    Widget dialog_child;
+manage_centered(Widget dialog_child)
 {
     Widget shell = XtParent(dialog_child);
     Window root, child;
@@ -731,8 +723,7 @@
  * Encapsulate the way an XmFontList is created.
  */
     XmFontList
-gui_motif_create_fontlist(font)
-    XFontStruct    *font;
+gui_motif_create_fontlist(XFontStruct *font)
 {
     XmFontList font_list;
 
@@ -753,8 +744,7 @@
 
 # if ((XmVersion > 1001) && defined(FEAT_XFONTSET)) || defined(PROTO)
     XmFontList
-gui_motif_fontset2fontlist(fontset)
-    XFontSet	*fontset;
+gui_motif_fontset2fontlist(XFontSet *fontset)
 {
     XmFontList font_list;
 
@@ -788,8 +778,7 @@
 static int menu_enabled = TRUE;
 
     void
-gui_mch_enable_menu(flag)
-    int	    flag;
+gui_mch_enable_menu(int flag)
 {
     if (flag)
     {
@@ -900,8 +889,7 @@
  * Enable or disable mnemonics for the toplevel menus.
  */
     void
-gui_motif_set_mnemonics(enable)
-    int		enable;
+gui_motif_set_mnemonics(int enable)
 {
     /*
      * Don't enable menu mnemonics when the menu bar is disabled, LessTif
@@ -913,8 +901,7 @@
 }
 
     static void
-do_set_mnemonics(enable)
-    int		enable;
+do_set_mnemonics(int enable)
 {
     vimmenu_T	*menu;
 
@@ -926,9 +913,7 @@
 }
 
     void
-gui_mch_add_menu(menu, idx)
-    vimmenu_T	*menu;
-    int		idx;
+gui_mch_add_menu(vimmenu_T *menu, int idx)
 {
     XmString	label;
     Widget	shell;
@@ -1036,8 +1021,7 @@
  * Add mnemonic and accelerator text to a menu button.
  */
     static void
-gui_motif_add_actext(menu)
-    vimmenu_T	*menu;
+gui_motif_add_actext(vimmenu_T *menu)
 {
     XmString	label;
 
@@ -1053,8 +1037,7 @@
 }
 
     void
-gui_mch_toggle_tearoffs(enable)
-    int		enable;
+gui_mch_toggle_tearoffs(int enable)
 {
 #if (XmVersion >= 1002)
     if (enable)
@@ -1072,8 +1055,7 @@
  * tearoff widget.
  */
     static void
-toggle_tearoff(wid)
-    Widget	wid;
+toggle_tearoff(Widget wid)
 {
     Widget	w;
 
@@ -1084,8 +1066,7 @@
 }
 
     static void
-gui_mch_recurse_tearoffs(menu)
-    vimmenu_T	*menu;
+gui_mch_recurse_tearoffs(vimmenu_T *menu)
 {
     while (menu != NULL)
     {
@@ -1101,7 +1082,7 @@
 #endif
 
     int
-gui_mch_text_area_extra_height()
+gui_mch_text_area_extra_height(void)
 {
     Dimension	shadowHeight;
 
@@ -1115,8 +1096,8 @@
  * there are several rows, and/or some characters extend higher or lower.
  */
     void
-gui_mch_compute_menu_height(id)
-    Widget	id;		    /* can be NULL when deleting menu */
+gui_mch_compute_menu_height(
+    Widget	id)		    /* can be NULL when deleting menu */
 {
     Dimension	y, maxy;
     Dimension	margin, shadow;
@@ -1200,8 +1181,7 @@
  * Read an Xpm file.  Return OK or FAIL.
  */
     static int
-check_xpm(path)
-    char_u	*path;
+check_xpm(char_u *path)
 {
     XpmAttributes attrs;
     int		status;
@@ -1229,9 +1209,7 @@
  * Return a blank pixmap if it fails.
  */
     static char **
-get_toolbar_pixmap(menu, fname)
-    vimmenu_T	*menu;
-    char	**fname;
+get_toolbar_pixmap(vimmenu_T *menu, char **fname)
 {
     char_u	buf[MAXPATHL];		/* buffer storing expanded pathname */
     char	**xpm = NULL;		/* xpm array */
@@ -1272,10 +1250,7 @@
  * Add arguments for the toolbar pixmap to a menu item.
  */
     static int
-add_pixmap_args(menu, args, n)
-    vimmenu_T	*menu;
-    Arg		*args;
-    int		n;
+add_pixmap_args(vimmenu_T *menu, Arg *args, int n)
 {
     vim_free(menu->xpm_fname);
     menu->xpm = get_toolbar_pixmap(menu, &menu->xpm_fname);
@@ -1297,9 +1272,7 @@
 #endif /* FEAT_TOOLBAR */
 
     void
-gui_mch_add_menu_item(menu, idx)
-    vimmenu_T	*menu;
-    int		idx;
+gui_mch_add_menu_item(vimmenu_T *menu, int idx)
 {
     XmString	label;
     vimmenu_T	*parent = menu->parent;
@@ -1457,8 +1430,7 @@
  * there exists a popup menu but it isn't managed.
  */
     void
-gui_motif_update_mousemodel(menu)
-    vimmenu_T	*menu;
+gui_motif_update_mousemodel(vimmenu_T *menu)
 {
     int		idx = 0;
 
@@ -1500,7 +1472,7 @@
 #endif
 
     void
-gui_mch_new_menu_colors()
+gui_mch_new_menu_colors(void)
 {
     if (menuBar == (Widget)0)
 	return;
@@ -1514,7 +1486,7 @@
 }
 
     void
-gui_mch_new_menu_font()
+gui_mch_new_menu_font(void)
 {
     if (menuBar == (Widget)0)
 	return;
@@ -1539,7 +1511,7 @@
 
 #if defined(FEAT_BEVAL) || defined(PROTO)
     void
-gui_mch_new_tooltip_font()
+gui_mch_new_tooltip_font(void)
 {
 # ifdef FEAT_TOOLBAR
     vimmenu_T   *menu;
@@ -1554,7 +1526,7 @@
 }
 
     void
-gui_mch_new_tooltip_colors()
+gui_mch_new_tooltip_colors(void)
 {
 # ifdef FEAT_TOOLBAR
     vimmenu_T   *toolbar;
@@ -1570,9 +1542,9 @@
 #endif
 
     static void
-submenu_change(menu, colors)
-    vimmenu_T	*menu;
-    int		colors;		/* TRUE for colors, FALSE for font */
+submenu_change(
+    vimmenu_T	*menu,
+    int		colors)		/* TRUE for colors, FALSE for font */
 {
     vimmenu_T	*mp;
 
@@ -1650,8 +1622,7 @@
  * Destroy the machine specific menu widget.
  */
     void
-gui_mch_destroy_menu(menu)
-    vimmenu_T	*menu;
+gui_mch_destroy_menu(vimmenu_T *menu)
 {
     /* Please be sure to destroy the parent widget first (i.e. menu->id).
      * On the other hand, problems have been reported that the submenu must be
@@ -1708,8 +1679,7 @@
 }
 
     void
-gui_mch_show_popupmenu(menu)
-    vimmenu_T *menu UNUSED;
+gui_mch_show_popupmenu(vimmenu_T *menu UNUSED)
 {
 #ifdef MOTIF_POPUP
     XmMenuPosition(menu->submenu_id, gui_x11_get_last_mouse_event());
@@ -1723,7 +1693,7 @@
  * Set the menu and scrollbar colors to their default values.
  */
     void
-gui_mch_def_colors()
+gui_mch_def_colors(void)
 {
     if (gui.in_use)
     {
@@ -1748,11 +1718,11 @@
  */
 
     void
-gui_mch_set_scrollbar_thumb(sb, val, size, max)
-    scrollbar_T *sb;
-    long	val;
-    long	size;
-    long	max;
+gui_mch_set_scrollbar_thumb(
+    scrollbar_T *sb,
+    long	val,
+    long	size,
+    long	max)
 {
     if (sb->id != (Widget)0)
 	XtVaSetValues(sb->id,
@@ -1764,12 +1734,12 @@
 }
 
     void
-gui_mch_set_scrollbar_pos(sb, x, y, w, h)
-    scrollbar_T *sb;
-    int		x;
-    int		y;
-    int		w;
-    int		h;
+gui_mch_set_scrollbar_pos(
+    scrollbar_T *sb,
+    int		x,
+    int		y,
+    int		w,
+    int		h)
 {
     if (sb->id != (Widget)0)
     {
@@ -1798,9 +1768,7 @@
 }
 
     void
-gui_mch_enable_scrollbar(sb, flag)
-    scrollbar_T *sb;
-    int		flag;
+gui_mch_enable_scrollbar(scrollbar_T *sb, int flag)
 {
     Arg		args[16];
     int		n;
@@ -1855,9 +1823,9 @@
 }
 
     void
-gui_mch_create_scrollbar(sb, orient)
-    scrollbar_T *sb;
-    int		orient;	/* SBAR_VERT or SBAR_HORIZ */
+gui_mch_create_scrollbar(
+    scrollbar_T *sb,
+    int		orient)	/* SBAR_VERT or SBAR_HORIZ */
 {
     Arg		args[16];
     int		n;
@@ -1913,8 +1881,7 @@
 
 #if defined(FEAT_WINDOWS) || defined(PROTO)
     void
-gui_mch_destroy_scrollbar(sb)
-    scrollbar_T *sb;
+gui_mch_destroy_scrollbar(scrollbar_T *sb)
 {
     if (sb->id != (Widget)0)
 	XtDestroyWidget(sb->id);
@@ -1922,8 +1889,7 @@
 #endif
 
     void
-gui_mch_set_scrollbar_colors(sb)
-    scrollbar_T *sb;
+gui_mch_set_scrollbar_colors(scrollbar_T *sb)
 {
     if (sb->id != (Widget)0)
     {
@@ -1957,7 +1923,7 @@
  */
 
     Window
-gui_x11_get_wid()
+gui_x11_get_wid(void)
 {
     return(XtWindow(textArea));
 }
@@ -2130,8 +2096,7 @@
  * Use the 'guifont' or 'guifontset' as a fontlist for a dialog widget.
  */
     static void
-set_fontlist(id)
-    Widget id;
+set_fontlist(Widget id)
 {
     XmFontList fl;
 
@@ -2211,11 +2176,8 @@
  */
 static void set_predefined_label(Widget parent, String name, char *new_label);
 
-static void
-set_predefined_label(parent, name, new_label)
-    Widget  parent;
-    String  name;
-    char    *new_label;
+    static void
+set_predefined_label(Widget parent, String name, char *new_label)
 {
     XmString	str;
     Widget	w;
@@ -2258,10 +2220,8 @@
     gui_motif_menu_fontlist(w);
 }
 
-static void
-set_predefined_fontlist(parent, name)
-    Widget parent;
-    String name;
+    static void
+set_predefined_fontlist(Widget parent, String name)
 {
     Widget w;
     w = XtNameToWidget(parent, name);
@@ -2277,13 +2237,13 @@
  * Returns the selected name in allocated memory, or NULL for Cancel.
  */
     char_u *
-gui_mch_browse(saving, title, dflt, ext, initdir, filter)
-    int		saving UNUSED;	/* select file to write */
-    char_u	*title;		/* title for the window */
-    char_u	*dflt;		/* default name */
-    char_u	*ext UNUSED;	/* not used (extension added) */
-    char_u	*initdir;	/* initial directory, NULL for current dir */
-    char_u	*filter;	/* file name filter */
+gui_mch_browse(
+    int		saving UNUSED,	/* select file to write */
+    char_u	*title,		/* title for the window */
+    char_u	*dflt,		/* default name */
+    char_u	*ext UNUSED,	/* not used (extension added) */
+    char_u	*initdir,	/* initial directory, NULL for current dir */
+    char_u	*filter)	/* file name filter */
 {
     char_u	dirbuf[MAXPATHL];
     char_u	dfltbuf[MAXPATHL];
@@ -2402,10 +2362,10 @@
  * Process callback from Dialog cancel actions.
  */
     static void
-DialogCancelCB(w, client_data, call_data)
-    Widget	w UNUSED;		/*  widget id		*/
-    XtPointer	client_data UNUSED;	/*  data from application   */
-    XtPointer	call_data UNUSED;	/*  data from widget class  */
+DialogCancelCB(
+    Widget	w UNUSED,		/*  widget id		*/
+    XtPointer	client_data UNUSED,	/*  data from application   */
+    XtPointer	call_data UNUSED)	/*  data from widget class  */
 {
     if (browse_fname != NULL)
     {
@@ -2419,10 +2379,10 @@
  * Process callback from Dialog actions.
  */
     static void
-DialogAcceptCB(w, client_data, call_data)
-    Widget	w UNUSED;		/*  widget id		*/
-    XtPointer	client_data UNUSED;	/*  data from application   */
-    XtPointer	call_data;		/*  data from widget class  */
+DialogAcceptCB(
+    Widget	w UNUSED,		/*  widget id		*/
+    XtPointer	client_data UNUSED,	/*  data from application   */
+    XtPointer	call_data)		/*  data from widget class  */
 {
     XmFileSelectionBoxCallbackStruct *fcb;
 
@@ -2454,11 +2414,11 @@
  * hitting the "OK" button, ESC like "Cancel".
  */
     static void
-keyhit_callback(w, client_data, event, cont)
-    Widget		w;
-    XtPointer		client_data UNUSED;
-    XEvent		*event;
-    Boolean		*cont UNUSED;
+keyhit_callback(
+    Widget		w,
+    XtPointer		client_data UNUSED,
+    XEvent		*event,
+    Boolean		*cont UNUSED)
 {
     char	buf[2];
     KeySym	key_sym;
@@ -2476,10 +2436,10 @@
 }
 
     static void
-butproc(w, client_data, call_data)
-    Widget	w UNUSED;
-    XtPointer	client_data;
-    XtPointer	call_data UNUSED;
+butproc(
+    Widget	w UNUSED,
+    XtPointer	client_data,
+    XtPointer	call_data UNUSED)
 {
     dialogStatus = (int)(long)client_data + 1;
 }
@@ -2489,12 +2449,12 @@
 static Widget create_pixmap_label(Widget parent, String name, char **data, ArgList args, Cardinal arg);
 
     static Widget
-create_pixmap_label(parent, name, data, args, arg)
-    Widget	parent;
-    String	name;
-    char	**data;
-    ArgList	args;
-    Cardinal	arg;
+create_pixmap_label(
+    Widget	parent,
+    String	name,
+    char	**data,
+    ArgList	args,
+    Cardinal	arg)
 {
     Widget		label;
     Display		*dsp;
@@ -2552,14 +2512,14 @@
 #endif
 
     int
-gui_mch_dialog(type, title, message, button_names, dfltbutton, textfield, ex_cmd)
-    int		type UNUSED;
-    char_u	*title;
-    char_u	*message;
-    char_u	*button_names;
-    int		dfltbutton;
-    char_u	*textfield;		/* buffer of size IOSIZE */
-    int		ex_cmd UNUSED;
+gui_mch_dialog(
+    int		type UNUSED,
+    char_u	*title,
+    char_u	*message,
+    char_u	*button_names,
+    int		dfltbutton,
+    char_u	*textfield,		/* buffer of size IOSIZE */
+    int		ex_cmd UNUSED)
 {
     char_u		*buts;
     char_u		*p, *next;
@@ -2927,7 +2887,7 @@
 #if defined(FEAT_FOOTER) || defined(PROTO)
 
     static int
-gui_mch_compute_footer_height()
+gui_mch_compute_footer_height(void)
 {
     Dimension	height;		    /* total Toolbar height */
     Dimension	top;		    /* XmNmarginTop */
@@ -2945,8 +2905,7 @@
 }
 
     void
-gui_mch_enable_footer(showit)
-    int		showit;
+gui_mch_enable_footer(int showit)
 {
     if (showit)
     {
@@ -2962,8 +2921,7 @@
 }
 
     void
-gui_mch_set_footer(s)
-    char_u	*s;
+gui_mch_set_footer(char_u *s)
 {
     XmString	xms;
 
@@ -3135,14 +3093,14 @@
  * input go to the editor window, not the button
  */
     static void
-reset_focus()
+reset_focus(void)
 {
     if (textArea != NULL)
 	XmProcessTraversal(textArea, XmTRAVERSE_CURRENT);
 }
 
     int
-gui_mch_compute_toolbar_height()
+gui_mch_compute_toolbar_height(void)
 {
     Dimension	borders;
     Dimension	height;		    /* total Toolbar height */
@@ -3189,12 +3147,12 @@
 }
 
     void
-motif_get_toolbar_colors(bgp, fgp, bsp, tsp, hsp)
-    Pixel       *bgp;
-    Pixel       *fgp;
-    Pixel       *bsp;
-    Pixel       *tsp;
-    Pixel       *hsp;
+motif_get_toolbar_colors(
+    Pixel       *bgp,
+    Pixel       *fgp,
+    Pixel       *bsp,
+    Pixel       *tsp,
+    Pixel       *hsp)
 {
     XtVaGetValues(toolBar,
 	    XmNbackground, bgp,
@@ -3212,11 +3170,11 @@
  * get implemented and the user will have a choice.
  */
     static void
-toolbarbutton_enter_cb(w, client_data, event, cont)
-    Widget	w UNUSED;
-    XtPointer	client_data;
-    XEvent	*event UNUSED;
-    Boolean	*cont UNUSED;
+toolbarbutton_enter_cb(
+    Widget	w UNUSED,
+    XtPointer	client_data,
+    XEvent	*event UNUSED,
+    Boolean	*cont UNUSED)
 {
     vimmenu_T	*menu = (vimmenu_T *) client_data;
 
@@ -3228,11 +3186,11 @@
 }
 
     static void
-toolbarbutton_leave_cb(w, client_data, event, cont)
-    Widget	w UNUSED;
-    XtPointer	client_data UNUSED;
-    XEvent	*event UNUSED;
-    Boolean	*cont UNUSED;
+toolbarbutton_leave_cb(
+    Widget	w UNUSED,
+    XtPointer	client_data UNUSED,
+    XEvent	*event UNUSED,
+    Boolean	*cont UNUSED)
 {
     gui_mch_set_footer((char_u *) "");
 }
@@ -3413,8 +3371,7 @@
  * Set the current tab to "nr".  First tab is 1.
  */
     void
-gui_mch_set_curtab(nr)
-    int		nr;
+gui_mch_set_curtab(int nr)
 {
     int		currentpage;
 
@@ -3431,8 +3388,7 @@
  * Set the colors of Widget "id" to the menu colors.
  */
     static void
-gui_motif_menu_colors(id)
-    Widget  id;
+gui_motif_menu_colors(Widget id)
 {
     if (gui.menu_bg_pixel != INVALCOLOR)
 #if (XmVersion >= 1002)
@@ -3448,8 +3404,7 @@
  * Set the colors of Widget "id" to the scrollbar colors.
  */
     static void
-gui_motif_scroll_colors(id)
-    Widget  id;
+gui_motif_scroll_colors(Widget id)
 {
     if (gui.scroll_bg_pixel != INVALCOLOR)
 #if (XmVersion >= 1002)
@@ -3465,8 +3420,7 @@
  * Set the fontlist for Widget "id" to use gui.menu_fontset or gui.menu_font.
  */
     void
-gui_motif_menu_fontlist(id)
-    Widget  id UNUSED;
+gui_motif_menu_fontlist(Widget id UNUSED)
 {
 #ifdef FEAT_MENU
 #ifdef FONTSET_ALWAYS
@@ -3548,10 +3502,10 @@
 static void find_replace_dialog_create(char_u *entry_text, int do_replace);
 
     static void
-find_replace_destroy_callback(w, client_data, call_data)
-    Widget	w UNUSED;
-    XtPointer	client_data;
-    XtPointer	call_data UNUSED;
+find_replace_destroy_callback(
+    Widget	w UNUSED,
+    XtPointer	client_data,
+    XtPointer	call_data UNUSED)
 {
     SharedFindReplace *cd = (SharedFindReplace *)client_data;
 
@@ -3561,10 +3515,10 @@
 }
 
     static void
-find_replace_dismiss_callback(w, client_data, call_data)
-    Widget	w UNUSED;
-    XtPointer	client_data;
-    XtPointer	call_data UNUSED;
+find_replace_dismiss_callback(
+    Widget	w UNUSED,
+    XtPointer	client_data,
+    XtPointer	call_data UNUSED)
 {
     SharedFindReplace *cd = (SharedFindReplace *)client_data;
 
@@ -3573,19 +3527,19 @@
 }
 
     static void
-entry_activate_callback(w, client_data, call_data)
-    Widget	w UNUSED;
-    XtPointer	client_data;
-    XtPointer	call_data UNUSED;
+entry_activate_callback(
+    Widget	w UNUSED,
+    XtPointer	client_data,
+    XtPointer	call_data UNUSED)
 {
     XmProcessTraversal((Widget)client_data, XmTRAVERSE_CURRENT);
 }
 
     static void
-find_replace_callback(w, client_data, call_data)
-    Widget	w UNUSED;
-    XtPointer	client_data;
-    XtPointer	call_data UNUSED;
+find_replace_callback(
+    Widget	w UNUSED,
+    XtPointer	client_data,
+    XtPointer	call_data UNUSED)
 {
     long_u	flags = (long_u)client_data;
     char	*find_text, *repl_text;
@@ -3636,10 +3590,10 @@
 }
 
     static void
-find_replace_keypress(w, frdp, event)
-    Widget		w UNUSED;
-    SharedFindReplace	*frdp;
-    XKeyEvent		*event;
+find_replace_keypress(
+    Widget		w UNUSED,
+    SharedFindReplace	*frdp,
+    XKeyEvent		*event)
 {
     KeySym keysym;
 
@@ -3654,9 +3608,7 @@
 }
 
     static void
-set_label(w, label)
-    Widget w;
-    char *label;
+set_label(Widget w, char *label)
 {
     XmString	str;
     char_u	*p, *next;
@@ -3696,9 +3648,7 @@
 }
 
     static void
-find_replace_dialog_create(arg, do_replace)
-    char_u	*arg;
-    int		do_replace;
+find_replace_dialog_create(char_u *arg, int do_replace)
 {
     SharedFindReplace	*frdp;
     Widget		separator;
@@ -4050,8 +4000,7 @@
 }
 
    void
-gui_mch_find_dialog(eap)
-    exarg_T	*eap;
+gui_mch_find_dialog(exarg_T *eap)
 {
     if (!gui.in_use)
 	return;
@@ -4061,8 +4010,7 @@
 
 
     void
-gui_mch_replace_dialog(eap)
-    exarg_T	*eap;
+gui_mch_replace_dialog(exarg_T *eap)
 {
     if (!gui.in_use)
 	return;
diff --git a/src/version.c b/src/version.c
index 0a36627..f850887 100644
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1207,
+/**/
     1206,
 /**/
     1205,
