summaryrefslogtreecommitdiff
path: root/src/if_cscope.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-01-13 23:38:42 +0100
committerBram Moolenaar <Bram@vim.org>2019-01-13 23:38:42 +0100
commitf9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d (patch)
treea6b07005c19279a4f5d01be14f14861c2657fa95 /src/if_cscope.c
parent05500ece6282407f9f7227aaf564e24147326863 (diff)
downloadvim-git-f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d.tar.gz
patch 8.1.0743: giving error messages is not flexiblev8.1.0743
Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes #3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts.
Diffstat (limited to 'src/if_cscope.c')
-rw-r--r--src/if_cscope.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/if_cscope.c b/src/if_cscope.c
index b06ad8c52..e1408b2f3 100644
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -76,7 +76,7 @@ static cscmd_T cs_cmds[] =
static void
cs_usage_msg(csid_e x)
{
- (void)EMSG2(_("E560: Usage: cs[cope] %s"), cs_cmds[(int)x].usage);
+ (void)semsg(_("E560: Usage: cs[cope] %s"), cs_cmds[(int)x].usage);
}
#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
@@ -254,7 +254,7 @@ ex_cstag(exarg_T *eap)
if (*eap->arg == NUL)
{
- (void)EMSG(_("E562: Usage: cstag <ident>"));
+ (void)emsg(_("E562: Usage: cstag <ident>"));
return;
}
@@ -312,7 +312,7 @@ ex_cstag(exarg_T *eap)
if (!ret)
{
- (void)EMSG(_("E257: cstag: tag not found"));
+ (void)emsg(_("E257: cstag: tag not found"));
#if defined(FEAT_QUICKFIX)
g_do_tagpreview = 0;
#endif
@@ -471,11 +471,11 @@ cs_stat_emsg(char *fname)
if (buf != NULL)
{
(void)sprintf(buf, stat_emsg, fname, errno);
- (void)EMSG(buf);
+ (void)emsg(buf);
vim_free(buf);
}
else
- (void)EMSG(_("E563: stat error"));
+ (void)emsg(_("E563: stat error"));
}
@@ -579,7 +579,7 @@ staterr:
else
{
if (p_csverbose)
- (void)EMSG2(
+ (void)semsg(
_("E564: %s is not a directory or a valid cscope database"),
fname);
goto add_err;
@@ -598,7 +598,7 @@ staterr:
{
msg_clr_eos();
(void)smsg_attr(HL_ATTR(HLF_R),
- (char_u *)_("Added cscope database %s"),
+ _("Added cscope database %s"),
csinfo[i].fname);
}
}
@@ -651,7 +651,7 @@ cs_cnt_connections(void)
cs_reading_emsg(
int idx) /* connection index */
{
- EMSGN(_("E262: error reading cscope connection %ld"), idx);
+ semsg(_("E262: error reading cscope connection %ld"), idx);
}
#define CSREAD_BUFSIZE 2048
@@ -757,7 +757,7 @@ cs_create_cmd(char *csoption, char *pattern)
search = 9;
break;
default :
- (void)EMSG(_("E561: unknown cscope search type"));
+ (void)emsg(_("E561: unknown cscope search type"));
cs_usage_msg(Find);
return NULL;
}
@@ -814,7 +814,7 @@ cs_create_connection(int i)
to_cs[0] = to_cs[1] = from_cs[0] = from_cs[1] = -1;
if (pipe(to_cs) < 0 || pipe(from_cs) < 0)
{
- (void)EMSG(_("E566: Could not create cscope pipes"));
+ (void)emsg(_("E566: Could not create cscope pipes"));
err_closing:
if (to_cs[0] != -1)
(void)close(to_cs[0]);
@@ -830,7 +830,7 @@ err_closing:
switch (csinfo[i].pid = fork())
{
case -1:
- (void)EMSG(_("E622: Could not fork for cscope"));
+ (void)emsg(_("E622: Could not fork for cscope"));
goto err_closing;
case 0: /* child: run cscope. */
if (dup2(to_cs[0], STDIN_FILENO) == -1)
@@ -853,7 +853,7 @@ err_closing:
if (!(pipe_stdin = CreatePipe(&stdin_rd, &stdin_wr, &sa, 0))
|| !(pipe_stdout = CreatePipe(&stdout_rd, &stdout_wr, &sa, 0)))
{
- (void)EMSG(_("E566: Could not create cscope pipes"));
+ (void)emsg(_("E566: Could not create cscope pipes"));
err_closing:
if (pipe_stdin)
{
@@ -987,7 +987,7 @@ err_closing:
if (!created)
{
PERROR(_("cs_create_connection exec failed"));
- (void)EMSG(_("E623: Could not spawn cscope process"));
+ (void)emsg(_("E623: Could not spawn cscope process"));
goto err_closing;
}
/* else */
@@ -1029,7 +1029,7 @@ cs_find(exarg_T *eap)
if (cs_check_for_connections() == FALSE)
{
- (void)EMSG(_("E567: no cscope connections"));
+ (void)emsg(_("E567: no cscope connections"));
return FALSE;
}
@@ -1127,7 +1127,7 @@ cs_find_common(
if (buf != NULL)
{
sprintf(buf, nf, *qfpos, *(qfpos-1));
- (void)EMSG(buf);
+ (void)emsg(buf);
vim_free(buf);
}
return FALSE;
@@ -1194,11 +1194,11 @@ cs_find_common(
buf = (char *)alloc((unsigned)(strlen(opt) + strlen(pat) + strlen(nf)));
if (buf == NULL)
- (void)EMSG(nf);
+ (void)emsg(nf);
else
{
sprintf(buf, nf, opt, pat);
- (void)EMSG(buf);
+ (void)emsg(buf);
vim_free(buf);
}
vim_free(nummatches);
@@ -1216,7 +1216,7 @@ cs_find_common(
f = mch_fopen((char *)tmp, "w");
if (f == NULL)
- EMSG2(_(e_notopen), tmp);
+ semsg(_(e_notopen), tmp);
else
{
cs_file_results(f, nummatches);
@@ -1289,7 +1289,7 @@ cs_help(exarg_T *eap UNUSED)
/* Use %*s rather than %30s to ensure proper alignment in utf-8 */
if (space_cnt < 0)
space_cnt = 0;
- (void)smsg((char_u *)_("%-5s: %s%*s (Usage: %s)"),
+ (void)smsg(_("%-5s: %s%*s (Usage: %s)"),
cmdp->name,
help, space_cnt, " ",
cmdp->usage);
@@ -1378,18 +1378,18 @@ cs_insert_filelist(
if (winmsg != NULL)
{
- (void)EMSG2(cant_msg, winmsg);
+ (void)semsg(cant_msg, winmsg);
LocalFree(winmsg);
}
else
/* subst filename if can't get error text */
- (void)EMSG2(cant_msg, fname);
+ (void)semsg(cant_msg, fname);
}
return -1;
case FILEINFO_INFO_FAIL: /* GetFileInformationByHandle() failed */
if (p_csverbose)
- (void)EMSG(_("E626: cannot get cscope database information"));
+ (void)emsg(_("E626: cannot get cscope database information"));
return -1;
}
#endif
@@ -1412,7 +1412,7 @@ cs_insert_filelist(
)
{
if (p_csverbose)
- (void)EMSG(_("E568: duplicate cscope database not added"));
+ (void)emsg(_("E568: duplicate cscope database not added"));
return -1;
}
@@ -1555,7 +1555,7 @@ cs_kill(exarg_T *eap UNUSED)
if ((i != -1) && (i >= csinfo_size || i < -1 || csinfo[i].fname == NULL))
{
if (p_csverbose)
- (void)EMSG2(_("E261: cscope connection %s not found"), stok);
+ (void)semsg(_("E261: cscope connection %s not found"), stok);
}
else
{
@@ -1587,7 +1587,7 @@ cs_kill_execute(
{
msg_clr_eos();
(void)smsg_attr(HL_ATTR(HLF_R) | MSG_HIST,
- (char_u *)_("cscope connection %s closed"), cname);
+ _("cscope connection %s closed"), cname);
}
cs_release_csp(i, TRUE);
}
@@ -1723,7 +1723,7 @@ cs_manage_matches(
cs_print_tags_priv(mp, cp, cnt);
break;
default: /* should not reach here */
- IEMSG(_("E570: fatal error in cs_manage_matches"));
+ iemsg(_("E570: fatal error in cs_manage_matches"));
return NULL;
}
@@ -2141,7 +2141,7 @@ cs_read_prompt(int i)
buf[bufpos - epromptlen] = NUL;
/* print message to user */
- (void)EMSG2(cs_emsg, buf);
+ (void)semsg(cs_emsg, buf);
/* send RETURN to cscope */
(void)putc('\n', csinfo[i].to_fp);
@@ -2162,7 +2162,7 @@ cs_read_prompt(int i)
{
PERROR("cs_read_prompt EOF");
if (buf != NULL && buf[0] != NUL)
- (void)EMSG2(cs_emsg, buf);
+ (void)semsg(cs_emsg, buf);
else if (p_csverbose)
cs_reading_emsg(i); /* don't have additional information */
cs_release_csp(i, TRUE);
@@ -2476,10 +2476,10 @@ cs_show(exarg_T *eap UNUSED)
continue;
if (csinfo[i].ppath != NULL)
- (void)smsg((char_u *)"%2d %-5ld %-34s %-32s",
+ (void)smsg("%2d %-5ld %-34s %-32s",
i, (long)csinfo[i].pid, csinfo[i].fname, csinfo[i].ppath);
else
- (void)smsg((char_u *)"%2d %-5ld %-34s <none>",
+ (void)smsg("%2d %-5ld %-34s <none>",
i, (long)csinfo[i].pid, csinfo[i].fname);
}
}