aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp.c
diff options
context:
space:
mode:
authorPavel Platto <hinidu@gmail.com>2014-07-13 10:03:07 +0300
committerNicolas Hillegeer <nicolas@hillegeer.com>2014-07-14 20:28:40 +0200
commit47084ea7657121837536d409b9137fd38426aeef (patch)
tree1bf014cf8e25a6875bc49328deafbfc9f5e0ef88 /src/nvim/regexp.c
parent2dc69700ec9a01b3b7cd4823e8cd3ad5431b9410 (diff)
downloadrneovim-47084ea7657121837536d409b9137fd38426aeef.tar.gz
rneovim-47084ea7657121837536d409b9137fd38426aeef.tar.bz2
rneovim-47084ea7657121837536d409b9137fd38426aeef.zip
Use strict function prototypes #945
`-Wstrict-prototypes` warn if a function is declared or defined without specifying the argument types. This warning disallow function prototypes with empty parameter list. In C, a function declared with an empty parameter list accepts an arbitrary number of arguments when being called. This is for historic reasons; originally, C functions didn't have prototypes, as C evolved from B, a typeless language. When prototypes were added, the original typeless declarations were left in the language for backwards compatibility. Instead we should provide `void` in argument list to state that function doesn't have arguments. Also this warning disallow declaring type of the parameters after the parentheses because Neovim header generator produce no declarations for old-stlyle prototypes: it expects to find `{` after prototype.
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r--src/nvim/regexp.c47
1 files changed, 19 insertions, 28 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index d21c005abe..f9f02eac9d 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -274,7 +274,7 @@
* This is impossible, so we declare a pointer to a function returning a
* pointer to a function returning void. This should work for all compilers.
*/
-typedef void (*(*fptr_T)(int *, int))();
+typedef void (*(*fptr_T)(int *, int))(void);
typedef struct {
char_u *regparse;
@@ -3266,21 +3266,20 @@ bt_regexec_nl (
}
-/*
- * Match a regexp against multiple lines.
- * "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
- * Uses curbuf for line count and 'iskeyword'.
- *
- * Return zero if there is no match. Return number of lines contained in the
- * match otherwise.
- */
-static long bt_regexec_multi(rmp, win, buf, lnum, col, tm)
-regmmatch_T *rmp;
-win_T *win; /* window in which to search or NULL */
-buf_T *buf; /* buffer in which to search */
-linenr_T lnum; /* nr of line to start looking for match */
-colnr_T col; /* column to start looking for match */
-proftime_T *tm; /* timeout limit or NULL */
+/// Matches a regexp against multiple lines.
+/// "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
+/// Uses curbuf for line count and 'iskeyword'.
+///
+/// @param win Window in which to search or NULL
+/// @param buf Buffer in which to search
+/// @param lnum Number of line to start looking for match
+/// @param col Column to start looking for match
+/// @param tm Timeout limit or NULL
+///
+/// @return zero if there is no match and number of lines contained in the match
+/// otherwise.
+static long bt_regexec_multi(regmmatch_T *rmp, win_T *win, buf_T *buf,
+ linenr_T lnum, colnr_T col, proftime_T *tm)
{
long r;
@@ -6265,36 +6264,28 @@ static char_u *cstrchr(char_u *s, int c)
-static fptr_T do_upper(d, c)
-int *d;
-int c;
+static fptr_T do_upper(int *d, int c)
{
*d = vim_toupper(c);
return (fptr_T)NULL;
}
-static fptr_T do_Upper(d, c)
-int *d;
-int c;
+static fptr_T do_Upper(int *d, int c)
{
*d = vim_toupper(c);
return (fptr_T)do_Upper;
}
-static fptr_T do_lower(d, c)
-int *d;
-int c;
+static fptr_T do_lower(int *d, int c)
{
*d = vim_tolower(c);
return (fptr_T)NULL;
}
-static fptr_T do_Lower(d, c)
-int *d;
-int c;
+static fptr_T do_Lower(int *d, int c)
{
*d = vim_tolower(c);