aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-03-03 13:09:36 +0100
committerGitHub <noreply@github.com>2018-03-03 13:09:36 +0100
commit37b755ab47a20418fca45c81037a973b4cc027e6 (patch)
treeb27203a4a164b9daee3656032a7c360941e63587 /src
parent3d2f4154b1d5d0bb063951c830e009505bdce359 (diff)
parente237cff0c8a2d77289983c39aa914bba76f25663 (diff)
downloadrneovim-37b755ab47a20418fca45c81037a973b4cc027e6.tar.gz
rneovim-37b755ab47a20418fca45c81037a973b4cc027e6.tar.bz2
rneovim-37b755ab47a20418fca45c81037a973b4cc027e6.zip
Merge #8072 from mhinz/vim-8.0.1439
vim-patch: 8.0.1439, 8.0.1442
Diffstat (limited to 'src')
-rw-r--r--src/nvim/if_cscope.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c
index 793142f153..b78b56562c 100644
--- a/src/nvim/if_cscope.c
+++ b/src/nvim/if_cscope.c
@@ -549,7 +549,7 @@ static void cs_reading_emsg(
static int cs_cnt_matches(size_t idx)
{
char *stok;
- int nlines;
+ int nlines = 0;
char *buf = xmalloc(CSREAD_BUFSIZE);
for (;; ) {
@@ -569,16 +569,20 @@ static int cs_cnt_matches(size_t idx)
return CSCOPE_FAILURE;
}
- /*
- * If the database is out of date, or there's some other problem,
- * cscope will output error messages before the number-of-lines output.
- * Display/discard any output that doesn't match what we want.
- * Accept "\S*cscope: X lines", also matches "mlcscope".
- */
- if ((stok = strtok(buf, (const char *)" ")) == NULL)
+ // If the database is out of date, or there's some other problem,
+ // cscope will output error messages before the number-of-lines output.
+ // Display/discard any output that doesn't match what we want.
+ // Accept "\S*cscope: X lines", also matches "mlcscope".
+ // Bail out for the "Unable to search" error.
+ if (strstr((const char *)buf, "Unable to search database") != NULL) {
+ break;
+ }
+ if ((stok = strtok(buf, (const char *)" ")) == NULL) {
continue;
- if (strstr((const char *)stok, "cscope:") == NULL)
+ }
+ if (strstr((const char *)stok, "cscope:") == NULL) {
continue;
+ }
if ((stok = strtok(NULL, (const char *)" ")) == NULL)
continue;