aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2017-03-11 00:26:44 -0500
committerJames McCoy <jamessan@jamessan.com>2017-03-11 20:32:39 -0500
commitd72c177b2a743e147e0386f97b07030b49247390 (patch)
tree72aeb690dabe2624cfd43c2b1da011270d15f467
parent2ed2b1d505cc028347b579f677eb8e6bde9dacdd (diff)
downloadrneovim-d72c177b2a743e147e0386f97b07030b49247390.tar.gz
rneovim-d72c177b2a743e147e0386f97b07030b49247390.tar.bz2
rneovim-d72c177b2a743e147e0386f97b07030b49247390.zip
lint
-rw-r--r--src/nvim/ex_cmds.c14
-rw-r--r--src/nvim/ex_docmd.c8
-rw-r--r--src/nvim/fileio.c14
-rw-r--r--src/nvim/getchar.c2
-rw-r--r--src/nvim/misc1.c2
-rw-r--r--src/nvim/option.c8
-rw-r--r--src/nvim/spell.c91
-rw-r--r--src/nvim/spellfile.c6
-rw-r--r--src/nvim/window.c14
9 files changed, 78 insertions, 81 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 54459792aa..1b83677807 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -4363,9 +4363,9 @@ void ex_help(exarg_T *eap)
if (!curwin->w_buffer->b_help
|| cmdmod.tab != 0
) {
- if (cmdmod.tab != 0)
+ if (cmdmod.tab != 0) {
wp = NULL;
- else {
+ } else {
wp = NULL;
FOR_ALL_WINDOWS_IN_TAB(wp2, curtab) {
if (wp2->w_buffer != NULL && wp2->w_buffer->b_help) {
@@ -4374,13 +4374,11 @@ void ex_help(exarg_T *eap)
}
}
}
- if (wp != NULL && wp->w_buffer->b_nwindows > 0)
+ if (wp != NULL && wp->w_buffer->b_nwindows > 0) {
win_enter(wp, true);
- else {
- /*
- * There is no help window yet.
- * Try to open the file specified by the "helpfile" option.
- */
+ } else {
+ // There is no help window yet.
+ // Try to open the file specified by the "helpfile" option.
if ((helpfd = mch_fopen((char *)p_hf, READBIN)) == NULL) {
smsg(_("Sorry, help file \"%s\" not found"), p_hf);
goto erret;
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index ba0e8295bf..340b7d442b 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -5853,12 +5853,12 @@ static void ex_close(exarg_T *eap)
{
win_T *win = NULL;
int winnr = 0;
- if (cmdwin_type != 0)
+ if (cmdwin_type != 0) {
cmdwin_result = Ctrl_C;
- else if (!text_locked() && !curbuf_locked()) {
- if (eap->addr_count == 0)
+ } else if (!text_locked() && !curbuf_locked()) {
+ if (eap->addr_count == 0) {
ex_win_close(eap->forceit, curwin, NULL);
- else {
+ } else {
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
winnr++;
if (winnr == eap->line2) {
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index f8b5a11642..040df707de 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -4751,14 +4751,14 @@ check_timestamps (
if (!stuff_empty() || global_busy || !typebuf_typed()
|| autocmd_busy || curbuf_lock > 0 || allbuf_lock > 0
- )
- need_check_timestamps = TRUE; /* check later */
- else {
- ++no_wait_return;
- did_check_timestamps = TRUE;
- already_warned = FALSE;
+ ) {
+ need_check_timestamps = true; // check later
+ } else {
+ no_wait_return++;
+ did_check_timestamps = true;
+ already_warned = false;
FOR_ALL_BUFFERS(buf) {
- /* Only check buffers in a window. */
+ // Only check buffers in a window.
if (buf->b_nwindows > 0) {
bufref_T bufref;
set_bufref(&bufref, buf);
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 2a5454cb92..6d1fab138c 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -2488,7 +2488,7 @@ int fix_input_buffer(char_u *buf, int len)
for (i = len; --i >= 0; ++p) {
if (p[0] == NUL
|| (p[0] == K_SPECIAL
- && (i < 2 || p[1] != KS_EXTRA))) {
+ && (i < 2 || p[1] != KS_EXTRA))) {
memmove(p + 3, p + 1, (size_t)i);
p[2] = (char_u)K_THIRD(p[0]);
p[1] = (char_u)K_SECOND(p[0]);
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index 09549e86ca..0bb5a8468d 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -2321,7 +2321,7 @@ int get_keystroke(void)
* terminal code to complete. */
n = os_inchar(buf + len, maxlen, len == 0 ? -1L : 100L, 0);
if (n > 0) {
- /* Replace zero and CSI by a special key code. */
+ // Replace zero and CSI by a special key code.
n = fix_input_buffer(buf + len, n);
len += n;
waited = 0;
diff --git a/src/nvim/option.c b/src/nvim/option.c
index ba0a501c4a..9a39581ec5 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -3625,10 +3625,10 @@ set_bool_option (
FOR_ALL_BUFFERS(bp) {
curbuf = bp;
- /* When 'undofile' is set globally: for every buffer, otherwise
- * only for the current buffer: Try to read in the undofile,
- * if one exists, the buffer wasn't changed and the buffer was
- * loaded */
+ // When 'undofile' is set globally: for every buffer, otherwise
+ // only for the current buffer: Try to read in the undofile,
+ // if one exists, the buffer wasn't changed and the buffer was
+ // loaded
if ((curbuf == save_curbuf
|| (opt_flags & OPT_GLOBAL) || opt_flags == 0)
&& !curbufIsChanged() && curbuf->b_ml.ml_mfp != NULL) {
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index c1bb77fd90..12f982106a 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -1795,15 +1795,14 @@ static void spell_load_cb(char_u *fname, void *cookie)
}
}
-// Add a word to the hashtable of common words.
-// If it's already there then the counter is increased.
-void
-count_common_word (
- slang_T *lp,
- char_u *word,
- int len, // word length, -1 for upto NUL
- int count // 1 to count once, 10 to init
-)
+/// Add a word to the hashtable of common words.
+/// If it's already there then the counter is increased.
+///
+/// @param[in] lp
+/// @param[in] word added to common words hashtable
+/// @param[in] len length of word or -1 for NUL terminated
+/// @param[in] count 1 to count once, 10 to init
+void count_common_word(slang_T *lp, char_u *word, int len, int count)
{
hash_T hash;
hashitem_T *hi;
@@ -2288,16 +2287,17 @@ static int find_region(char_u *rp, char_u *region)
return i / 2;
}
-// Return case type of word:
-// w word 0
-// Word WF_ONECAP
-// W WORD WF_ALLCAP
-// WoRd wOrd WF_KEEPCAP
-int
-captype (
- char_u *word,
- char_u *end // When NULL use up to NUL byte.
-)
+/// Return case type of word:
+/// w word 0
+/// Word WF_ONECAP
+/// W WORD WF_ALLCAP
+/// WoRd wOrd WF_KEEPCAP
+///
+/// @param[in] word
+/// @param[in] end End of word or NULL for NUL delimited string
+///
+/// @returns Case type of word
+int captype(char_u *word, char_u *end)
{
char_u *p;
int c;
@@ -3396,15 +3396,14 @@ static void spell_find_cleanup(suginfo_T *su)
hash_clear_all(&su->su_banned, 0);
}
-// Make a copy of "word", with the first letter upper or lower cased, to
-// "wcopy[MAXWLEN]". "word" must not be empty.
-// The result is NUL terminated.
-void
-onecap_copy (
- char_u *word,
- char_u *wcopy,
- bool upper // true: first letter made upper case
-)
+/// Make a copy of "word", with the first letter upper or lower cased, to
+/// "wcopy[MAXWLEN]". "word" must not be empty.
+/// The result is NUL terminated.
+///
+/// @param[in] word source string to copy
+/// @param[in,out] wcopy copied string, with case of first letter changed
+/// @param[in] upper True to upper case, otherwise lower case
+void onecap_copy(char_u *word, char_u *wcopy, bool upper)
{
char_u *p;
int c;
@@ -4982,8 +4981,9 @@ static void find_keepcap_word(slang_T *slang, char_u *fword, char_u *kword)
if (has_mbyte) {
flen = MB_CPTR2LEN(fword + fwordidx[depth]);
ulen = MB_CPTR2LEN(uword + uwordidx[depth]);
- } else
+ } else {
ulen = flen = 1;
+ }
if (round[depth] == 1) {
p = fword + fwordidx[depth];
l = flen;
@@ -5885,23 +5885,22 @@ char_u *eval_soundfold(char_u *word)
return vim_strsave(word);
}
-// Turn "inword" into its sound-a-like equivalent in "res[MAXWLEN]".
-//
-// There are many ways to turn a word into a sound-a-like representation. The
-// oldest is Soundex (1918!). A nice overview can be found in "Approximate
-// swedish name matching - survey and test of different algorithms" by Klas
-// Erikson.
-//
-// We support two methods:
-// 1. SOFOFROM/SOFOTO do a simple character mapping.
-// 2. SAL items define a more advanced sound-folding (and much slower).
-void
-spell_soundfold (
- slang_T *slang,
- char_u *inword,
- bool folded, // "inword" is already case-folded
- char_u *res
-)
+/// Turn "inword" into its sound-a-like equivalent in "res[MAXWLEN]".
+///
+/// There are many ways to turn a word into a sound-a-like representation. The
+/// oldest is Soundex (1918!). A nice overview can be found in "Approximate
+/// swedish name matching - survey and test of different algorithms" by Klas
+/// Erikson.
+///
+/// We support two methods:
+/// 1. SOFOFROM/SOFOTO do a simple character mapping.
+/// 2. SAL items define a more advanced sound-folding (and much slower).
+///
+/// @param[in] slang
+/// @param[in] inword word to soundfold
+/// @param[in] folded whether inword is already case-folded
+/// @param[in,out] res destination for soundfolded word
+void spell_soundfold(slang_T *slang, char_u *inword, bool folded, char_u *res)
{
char_u fword[MAXWLEN];
char_u *word;
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c
index b3fc0a6c77..c108ae4a2c 100644
--- a/src/nvim/spellfile.c
+++ b/src/nvim/spellfile.c
@@ -384,14 +384,12 @@ struct sblock_S {
// A node in the tree.
typedef struct wordnode_S wordnode_T;
struct wordnode_S {
- union // shared to save space
- {
+ union { // shared to save space
char_u hashkey[6]; // the hash key, only used while compressing
int index; // index in written nodes (valid after first
// round)
} wn_u1;
- union // shared to save space
- {
+ union { // shared to save space
wordnode_T *next; // next node with same hash key
wordnode_T *wnode; // parent node that will write this node
} wn_u2;
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 00baa23306..bae7c2e7dc 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -168,10 +168,11 @@ newwindow:
break;
}
}
- if (wp == NULL)
+ if (wp == NULL) {
EMSG(_("E441: There is no preview window"));
- else
+ } else {
win_goto(wp);
+ }
break;
/* close all but current window */
@@ -3366,10 +3367,10 @@ void tabpage_move(int nr)
tp_dst = tp;
- /* Remove the current tab page from the list of tab pages. */
- if (curtab == first_tabpage)
+ // Remove the current tab page from the list of tab pages.
+ if (curtab == first_tabpage) {
first_tabpage = curtab->tp_next;
- else {
+ } else {
tp = NULL;
FOR_ALL_TABS(tp2) {
if (tp2->tp_next == curtab) {
@@ -3377,8 +3378,9 @@ void tabpage_move(int nr)
break;
}
}
- if (tp == NULL) /* "cannot happen" */
+ if (tp == NULL) { // "cannot happen"
return;
+ }
tp->tp_next = curtab->tp_next;
}