diff options
author | Pavel Platto <hinidu@gmail.com> | 2014-07-13 10:03:07 +0300 |
---|---|---|
committer | Nicolas Hillegeer <nicolas@hillegeer.com> | 2014-07-14 20:28:40 +0200 |
commit | 47084ea7657121837536d409b9137fd38426aeef (patch) | |
tree | 1bf014cf8e25a6875bc49328deafbfc9f5e0ef88 /src/nvim/regexp_nfa.c | |
parent | 2dc69700ec9a01b3b7cd4823e8cd3ad5431b9410 (diff) | |
download | rneovim-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_nfa.c')
-rw-r--r-- | src/nvim/regexp_nfa.c | 68 |
1 files changed, 36 insertions, 32 deletions
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c index 644e7d38a9..21581d3823 100644 --- a/src/nvim/regexp_nfa.c +++ b/src/nvim/regexp_nfa.c @@ -6338,38 +6338,42 @@ nfa_regexec_nl ( return nfa_regexec_both(line, col) != 0; } -/* - * 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. - * - * Note: the body is the same as bt_regexec() except for nfa_regexec_both() - * - * ! Also NOTE : match may actually be in another line. e.g.: - * when r.e. is \nc, cursor is at 'a' and the text buffer looks like - * - * +-------------------------+ - * |a | - * |b | - * |c | - * | | - * +-------------------------+ - * - * then nfa_regexec_multi() returns 3. while the original - * vim_regexec_multi() returns 0 and a second call at line 2 will return 2. - * - * FIXME if this behavior is not compatible. - */ -static long nfa_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. +/// +/// @note The body is the same as bt_regexec() except for nfa_regexec_both() +/// +/// @warning +/// Match may actually be in another line. e.g.: +/// when r.e. is \nc, cursor is at 'a' and the text buffer looks like +/// +/// @par +/// +/// +-------------------------+ +/// |a | +/// |b | +/// |c | +/// | | +/// +-------------------------+ +/// +/// @par +/// then nfa_regexec_multi() returns 3. while the original vim_regexec_multi() +/// returns 0 and a second call at line 2 will return 2. +/// +/// @par +/// FIXME if this behavior is not compatible. +static long nfa_regexec_multi(regmmatch_T *rmp, win_T *win, buf_T *buf, + linenr_T lnum, colnr_T col, proftime_T *tm) { reg_match = NULL; reg_mmatch = rmp; |