diff options
author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-07-23 00:23:18 -0400 |
---|---|---|
committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-07-23 08:34:25 -0400 |
commit | 84b8612987320f722c33dff3a3f16930407c62ce (patch) | |
tree | 9c930548001b4db351b6a8a423bb4e59a095a1f5 /src/nvim/spell.c | |
parent | 9fbbec76aaa8d45ba54bb136b750f2ccc440207f (diff) | |
download | rneovim-84b8612987320f722c33dff3a3f16930407c62ce.tar.gz rneovim-84b8612987320f722c33dff3a3f16930407c62ce.tar.bz2 rneovim-84b8612987320f722c33dff3a3f16930407c62ce.zip |
vim-patch:8.0.1512: warning for possibly using NULL pointer
Problem: Warning for possibly using NULL pointer. (Coverity)
Solution: Skip using the pointer if it's NULL.
https://github.com/vim/vim/commit/e4db7aedab65abadcc84c78e7a10ec7bb62f11cf
Diffstat (limited to 'src/nvim/spell.c')
-rw-r--r-- | src/nvim/spell.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 0714eb3137..cb03257878 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -2043,9 +2043,11 @@ char_u *did_set_spelllang(win_T *wp) dont_use_region = true; // Check if we loaded this language before. - for (slang = first_lang; slang != NULL; slang = slang->sl_next) - if (path_full_compare(lang, slang->sl_fname, FALSE) == kEqualFiles) + for (slang = first_lang; slang != NULL; slang = slang->sl_next) { + if (path_full_compare(lang, slang->sl_fname, false) == kEqualFiles) { break; + } + } } else { filename = false; if (len > 3 && lang[len - 3] == '_') { @@ -2085,8 +2087,9 @@ char_u *did_set_spelllang(win_T *wp) } // Loop over the languages, there can be several files for "lang". - for (slang = first_lang; slang != NULL; slang = slang->sl_next) - if (filename ? path_full_compare(lang, slang->sl_fname, FALSE) == kEqualFiles + for (slang = first_lang; slang != NULL; slang = slang->sl_next) { + if (filename + ? path_full_compare(lang, slang->sl_fname, false) == kEqualFiles : STRICMP(lang, slang->sl_name) == 0) { region_mask = REGION_ALL; if (!filename && region != NULL) { @@ -2116,6 +2119,7 @@ char_u *did_set_spelllang(win_T *wp) nobreak = true; } } + } } // round 0: load int_wordlist, if possible. @@ -2137,17 +2141,21 @@ char_u *did_set_spelllang(win_T *wp) // If it was already found above then skip it. for (c = 0; c < ga.ga_len; ++c) { p = LANGP_ENTRY(ga, c)->lp_slang->sl_fname; - if (p != NULL && path_full_compare(spf_name, p, FALSE) == kEqualFiles) + if (p != NULL + && path_full_compare(spf_name, p, false) == kEqualFiles) { break; + } } if (c < ga.ga_len) continue; } // Check if it was loaded already. - for (slang = first_lang; slang != NULL; slang = slang->sl_next) - if (path_full_compare(spf_name, slang->sl_fname, FALSE) == kEqualFiles) + for (slang = first_lang; slang != NULL; slang = slang->sl_next) { + if (path_full_compare(spf_name, slang->sl_fname, false) == kEqualFiles) { break; + } + } if (slang == NULL) { // Not loaded, try loading it now. The language name includes the // region name, the region is ignored otherwise. for int_wordlist |