diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-01-13 23:38:42 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-01-13 23:38:42 +0100 |
commit | f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d (patch) | |
tree | a6b07005c19279a4f5d01be14f14861c2657fa95 /src/misc2.c | |
parent | 05500ece6282407f9f7227aaf564e24147326863 (diff) | |
download | vim-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/misc2.c')
-rw-r--r-- | src/misc2.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/misc2.c b/src/misc2.c index 2d39eb8b4..0bbcb3992 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -920,7 +920,7 @@ alloc_check(unsigned size) { /* Don't hide this message */ emsg_silent = 0; - EMSG(_("E340: Line is becoming too long")); + emsg(_("E340: Line is becoming too long")); return NULL; } #endif @@ -960,7 +960,7 @@ lalloc(long_u size, int message) { /* Don't hide this message */ emsg_silent = 0; - IEMSGN(_("E341: Internal error: lalloc(%ld, )"), size); + siemsg(_("E341: Internal error: lalloc(%ld, )"), size); return NULL; } @@ -1079,7 +1079,7 @@ do_outofmem_msg(long_u size) * message fails, e.g. when setting v:errmsg. */ did_outofmem_msg = TRUE; - EMSGN(_("E342: Out of memory! (allocating %lu bytes)"), size); + semsg(_("E342: Out of memory! (allocating %lu bytes)"), size); } } @@ -3272,7 +3272,7 @@ call_shell(char_u *cmd, int opt) if (p_verbose > 3) { verbose_enter(); - smsg((char_u *)_("Calling shell to execute: \"%s\""), + smsg(_("Calling shell to execute: \"%s\""), cmd == NULL ? p_sh : cmd); out_char('\n'); cursor_on(); @@ -3286,7 +3286,7 @@ call_shell(char_u *cmd, int opt) if (*p_sh == NUL) { - EMSG(_(e_shellempty)); + emsg(_(e_shellempty)); retval = -1; } else @@ -3538,7 +3538,7 @@ static char * mshape_names[] = * ("what" is SHAPE_MOUSE). * Returns error message for an illegal option, NULL otherwise. */ - char_u * + char * parse_shape_opt(int what) { char_u *modep; @@ -3574,9 +3574,9 @@ parse_shape_opt(int what) commap = vim_strchr(modep, ','); if (colonp == NULL || (commap != NULL && commap < colonp)) - return (char_u *)N_("E545: Missing colon"); + return N_("E545: Missing colon"); if (colonp == modep) - return (char_u *)N_("E546: Illegal mode"); + return N_("E546: Illegal mode"); /* * Repeat for all mode's before the colon. @@ -3602,7 +3602,7 @@ parse_shape_opt(int what) break; if (idx == SHAPE_IDX_COUNT || (shape_table[idx].used_for & what) == 0) - return (char_u *)N_("E546: Illegal mode"); + return N_("E546: Illegal mode"); if (len == 2 && modep[0] == 'v' && modep[1] == 'e') found_ve = TRUE; } @@ -3641,7 +3641,7 @@ parse_shape_opt(int what) if (mshape_names[i] == NULL) { if (!VIM_ISDIGIT(*p)) - return (char_u *)N_("E547: Illegal mouseshape"); + return N_("E547: Illegal mouseshape"); if (round == 2) shape_table[idx].mshape = getdigits(&p) + MSHAPE_NUMBERED; @@ -3681,12 +3681,12 @@ parse_shape_opt(int what) { p += len; if (!VIM_ISDIGIT(*p)) - return (char_u *)N_("E548: digit expected"); + return N_("E548: digit expected"); n = getdigits(&p); if (len == 3) /* "ver" or "hor" */ { if (n == 0) - return (char_u *)N_("E549: Illegal percentage"); + return N_("E549: Illegal percentage"); if (round == 2) { if (TOLOWER_ASC(i) == 'v') @@ -4385,7 +4385,7 @@ vim_findfile_init( { if (len + 5 >= MAXPATHL) { - EMSG(_(e_pathtoolong)); + emsg(_(e_pathtoolong)); break; } if (STRNCMP(wc_part, "**", 2) == 0) @@ -4404,7 +4404,7 @@ vim_findfile_init( wc_part = (char_u *)errpt; if (*wc_part != NUL && !vim_ispathsep(*wc_part)) { - EMSG2(_("E343: Invalid path: '**[number]' must be at the end of the path or be followed by '%s'."), PATHSEPSTR); + semsg(_("E343: Invalid path: '**[number]' must be at the end of the path or be followed by '%s'."), PATHSEPSTR); goto error_return; } } @@ -4436,7 +4436,7 @@ vim_findfile_init( if (STRLEN(search_ctx->ffsc_start_dir) + STRLEN(search_ctx->ffsc_fix_path) + 3 >= MAXPATHL) { - EMSG(_(e_pathtoolong)); + emsg(_(e_pathtoolong)); goto error_return; } STRCPY(ff_expand_buffer, search_ctx->ffsc_start_dir); @@ -4667,7 +4667,7 @@ vim_findfile(void *search_ctx_arg) if (p_verbose >= 5) { verbose_enter_scroll(); - smsg((char_u *)"Already Searched: %s (%s)", + smsg("Already Searched: %s (%s)", stackp->ffs_fix_path, stackp->ffs_wc_path); /* don't overwrite this either */ msg_puts((char_u *)"\n"); @@ -4681,7 +4681,7 @@ vim_findfile(void *search_ctx_arg) else if (p_verbose >= 5) { verbose_enter_scroll(); - smsg((char_u *)"Searching: %s (%s)", + smsg("Searching: %s (%s)", stackp->ffs_fix_path, stackp->ffs_wc_path); /* don't overwrite this either */ msg_puts((char_u *)"\n"); @@ -4900,7 +4900,7 @@ vim_findfile(void *search_ctx_arg) if (p_verbose >= 5) { verbose_enter_scroll(); - smsg((char_u *)"Already: %s", + smsg("Already: %s", file_path); /* don't overwrite this either */ msg_puts((char_u *)"\n"); @@ -4928,7 +4928,7 @@ vim_findfile(void *search_ctx_arg) if (p_verbose >= 5) { verbose_enter_scroll(); - smsg((char_u *)"HIT: %s", file_path); + smsg("HIT: %s", file_path); /* don't overwrite this either */ msg_puts((char_u *)"\n"); verbose_leave_scroll(); @@ -5128,7 +5128,7 @@ ff_get_visited_list( if (p_verbose >= 5) { verbose_enter_scroll(); - smsg((char_u *)"ff_get_visited_list: FOUND list for %s", + smsg("ff_get_visited_list: FOUND list for %s", filename); /* don't overwrite this either */ msg_puts((char_u *)"\n"); @@ -5145,7 +5145,7 @@ ff_get_visited_list( if (p_verbose >= 5) { verbose_enter_scroll(); - smsg((char_u *)"ff_get_visited_list: new list for %s", filename); + smsg("ff_get_visited_list: new list for %s", filename); /* don't overwrite this either */ msg_puts((char_u *)"\n"); verbose_leave_scroll(); @@ -5766,19 +5766,19 @@ find_file_in_path_option( if (first == TRUE) { if (find_what == FINDFILE_DIR) - EMSG2(_("E344: Can't find directory \"%s\" in cdpath"), + semsg(_("E344: Can't find directory \"%s\" in cdpath"), ff_file_to_find); else - EMSG2(_("E345: Can't find file \"%s\" in path"), + semsg(_("E345: Can't find file \"%s\" in path"), ff_file_to_find); } else { if (find_what == FINDFILE_DIR) - EMSG2(_("E346: No more directory \"%s\" found in cdpath"), + semsg(_("E346: No more directory \"%s\" found in cdpath"), ff_file_to_find); else - EMSG2(_("E347: No more file \"%s\" found in path"), + semsg(_("E347: No more file \"%s\" found in path"), ff_file_to_find); } } |