To: vim_dev@googlegroups.com Subject: Patch 8.2.3561 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3561 Problem: Cscope has a complicated way of giving an error message. Solution: Use semsg(). (James McCoy, closes #9038) Files: src/if_cscope.c *** ../vim-8.2.3560/src/if_cscope.c 2021-10-02 11:23:01.566500862 +0100 --- src/if_cscope.c 2021-10-24 14:39:30.264211566 +0100 *************** *** 462,478 **** static void cs_stat_emsg(char *fname) { ! char *stat_emsg = _("E563: stat(%s) error: %d"); ! char *buf = alloc(strlen(stat_emsg) + MAXPATHL + 10); ! ! if (buf != NULL) ! { ! (void)sprintf(buf, stat_emsg, fname, errno); ! (void)emsg(buf); ! vim_free(buf); ! } ! else ! (void)emsg(_("E563: stat error")); } --- 462,469 ---- static void cs_stat_emsg(char *fname) { ! int err = errno; ! (void)semsg(_("E563: stat(%s) error: %d"), fname, err); } *************** *** 1114,1129 **** // next symbol must be + or - if (strchr(CSQF_FLAGS, *qfpos) == NULL) { ! char *nf = _("E469: invalid cscopequickfix flag %c for %c"); ! char *buf = alloc(strlen(nf)); ! ! // strlen will be enough because we use chars ! if (buf != NULL) ! { ! sprintf(buf, nf, *qfpos, *(qfpos-1)); ! (void)emsg(buf); ! vim_free(buf); ! } return FALSE; } --- 1105,1111 ---- // next symbol must be + or - if (strchr(CSQF_FLAGS, *qfpos) == NULL) { ! (void)semsg(_("E469: invalid cscopequickfix flag %c for %c"), *qfpos, *(qfpos - 1)); return FALSE; } *************** *** 1177,1200 **** if (totmatches == 0) { ! char *nf = _("E259: no matches found for cscope query %s of %s"); ! char *buf; ! ! if (!verbose) ! { ! vim_free(nummatches); ! return FALSE; ! } ! ! buf = alloc(strlen(opt) + strlen(pat) + strlen(nf)); ! if (buf == NULL) ! (void)emsg(nf); ! else ! { ! sprintf(buf, nf, opt, pat); ! (void)emsg(buf); ! vim_free(buf); ! } vim_free(nummatches); return FALSE; } --- 1159,1166 ---- if (totmatches == 0) { ! if (verbose) ! (void)semsg(_("E259: no matches found for cscope query %s of %s"), opt, pat); vim_free(nummatches); return FALSE; } *** ../vim-8.2.3560/src/version.c 2021-10-23 13:32:27.227954893 +0100 --- src/version.c 2021-10-24 14:44:33.472301970 +0100 *************** *** 759,760 **** --- 759,762 ---- { /* Add new patch number below this line */ + /**/ + 3561, /**/ -- hundred-and-one symptoms of being an internet addict: 235. You start naming your kids Pascal, COBOL, Algol and Fortran. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///