aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2021-10-24 11:04:28 -0400
committerJames McCoy <jamessan@jamessan.com>2021-11-01 06:41:29 -0400
commit9e479ea05e00e63ccc985fc8ce4912c709f30111 (patch)
treeccff91c244e6804922f96ba67edabad9e5390de3
parent502ff11663aa6039291a2ccf75bff0723cdcec70 (diff)
downloadrneovim-9e479ea05e00e63ccc985fc8ce4912c709f30111.tar.gz
rneovim-9e479ea05e00e63ccc985fc8ce4912c709f30111.tar.bz2
rneovim-9e479ea05e00e63ccc985fc8ce4912c709f30111.zip
vim-patch:8.2.3561: cscope has a complicated way of giving an error message
Problem: Cscope has a complicated way of giving an error message. Solution: Use semsg(). (James McCoy, closes vim/vim#9038) https://github.com/vim/vim/commit/3c5904d2a5d7861c227a4c3cd4ddcbc51014c838
-rw-r--r--src/nvim/if_cscope.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c
index 24a85e9595..5b5f056164 100644
--- a/src/nvim/if_cscope.c
+++ b/src/nvim/if_cscope.c
@@ -403,12 +403,8 @@ static int cs_add(exarg_T *eap)
static void cs_stat_emsg(char *fname)
{
- char *stat_emsg = _("E563: stat(%s) error: %d");
- char *buf = xmalloc(strlen(stat_emsg) + MAXPATHL + 10);
-
- (void)sprintf(buf, stat_emsg, fname, errno);
- (void)emsg(buf);
- xfree(buf);
+ int err = errno;
+ (void)semsg(_("E563: stat(%s) error: %d"), fname, err);
}
@@ -970,13 +966,7 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, int us
qfpos++;
// next symbol must be + or -
if (strchr(CSQF_FLAGS, *qfpos) == NULL) {
- char *nf = _("E469: invalid cscopequickfix flag %c for %c");
- // strlen will be enough because we use chars
- char *buf = xmalloc(strlen(nf));
-
- sprintf(buf, nf, *qfpos, *(qfpos-1));
- (void)emsg(buf);
- xfree(buf);
+ (void)semsg(_("E469: invalid cscopequickfix flag %c for %c"), *qfpos, *(qfpos - 1));;
return FALSE;
}
@@ -1025,18 +1015,9 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, int us
xfree(cmd);
if (totmatches == 0) {
- char *nf = _("E259: no matches found for cscope query %s of %s");
- char *buf;
-
- if (!verbose) {
- xfree(nummatches);
- return FALSE;
+ if (verbose) {
+ (void)semsg(_("E259: no matches found for cscope query %s of %s"), opt, pat);
}
-
- buf = xmalloc(strlen(opt) + strlen(pat) + strlen(nf));
- sprintf(buf, nf, opt, pat);
- (void)emsg(buf);
- xfree(buf);
xfree(nummatches);
return FALSE;
}