Mercurial > vim
comparison src/misc1.c @ 15470:55ccc2d353bd v8.1.0743
patch 8.1.0743: giving error messages is not flexible
commit https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 13 23:38:42 2019 +0100
patch 8.1.0743: giving error messages is not flexible
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 13 Jan 2019 23:45:08 +0100 |
parents | 9171193ae720 |
children | 3ef31ce9d9f9 |
comparison
equal
deleted
inserted
replaced
15469:bc9b5261ed01 | 15470:55ccc2d353bd |
---|---|
2656 return OK; | 2656 return OK; |
2657 | 2657 |
2658 /* If "count" is negative the caller must be doing something wrong. */ | 2658 /* If "count" is negative the caller must be doing something wrong. */ |
2659 if (count < 1) | 2659 if (count < 1) |
2660 { | 2660 { |
2661 IEMSGN("E950: Invalid count for del_bytes(): %ld", count); | 2661 siemsg("E950: Invalid count for del_bytes(): %ld", count); |
2662 return FAIL; | 2662 return FAIL; |
2663 } | 2663 } |
2664 | 2664 |
2665 #ifdef FEAT_MBYTE | 2665 #ifdef FEAT_MBYTE |
2666 /* If 'delcombine' is set and deleting (less than) one character, only | 2666 /* If 'delcombine' is set and deleting (less than) one character, only |
3519 ++allow_keys; /* no mapping here, but recognize keys */ | 3519 ++allow_keys; /* no mapping here, but recognize keys */ |
3520 | 3520 |
3521 while (r != 'y' && r != 'n') | 3521 while (r != 'y' && r != 'n') |
3522 { | 3522 { |
3523 /* same highlighting as for wait_return */ | 3523 /* same highlighting as for wait_return */ |
3524 smsg_attr(HL_ATTR(HLF_R), (char_u *)"%s (y/n)?", str); | 3524 smsg_attr(HL_ATTR(HLF_R), "%s (y/n)?", str); |
3525 if (direct) | 3525 if (direct) |
3526 r = get_keystroke(); | 3526 r = get_keystroke(); |
3527 else | 3527 else |
3528 r = plain_vgetc(); | 3528 r = plain_vgetc(); |
3529 if (r == Ctrl_C || r == ESC) | 3529 if (r == Ctrl_C || r == ESC) |
4058 && mch_chdir((char *)NameBuff) == 0) | 4058 && mch_chdir((char *)NameBuff) == 0) |
4059 { | 4059 { |
4060 if (!mch_chdir((char *)var) && mch_dirname(IObuff, IOSIZE) == OK) | 4060 if (!mch_chdir((char *)var) && mch_dirname(IObuff, IOSIZE) == OK) |
4061 var = IObuff; | 4061 var = IObuff; |
4062 if (mch_chdir((char *)NameBuff) != 0) | 4062 if (mch_chdir((char *)NameBuff) != 0) |
4063 EMSG(_(e_prev_dir)); | 4063 emsg(_(e_prev_dir)); |
4064 } | 4064 } |
4065 #endif | 4065 #endif |
4066 homedir = vim_strsave(var); | 4066 homedir = vim_strsave(var); |
4067 } | 4067 } |
4068 } | 4068 } |
9940 int flags) /* EW_DIR, etc. */ | 9940 int flags) /* EW_DIR, etc. */ |
9941 { | 9941 { |
9942 int ret = FAIL; | 9942 int ret = FAIL; |
9943 char_u *eval_pat = NULL; | 9943 char_u *eval_pat = NULL; |
9944 char_u *exp_pat = *pat; | 9944 char_u *exp_pat = *pat; |
9945 char_u *ignored_msg; | 9945 char *ignored_msg; |
9946 int usedlen; | 9946 int usedlen; |
9947 | 9947 |
9948 if (*exp_pat == '%' || *exp_pat == '#' || *exp_pat == '<') | 9948 if (*exp_pat == '%' || *exp_pat == '#' || *exp_pat == '<') |
9949 { | 9949 { |
9950 ++emsg_off; | 9950 ++emsg_off; |
11432 return NULL; | 11432 return NULL; |
11433 | 11433 |
11434 /* get a name for the temp file */ | 11434 /* get a name for the temp file */ |
11435 if ((tempname = vim_tempname('o', FALSE)) == NULL) | 11435 if ((tempname = vim_tempname('o', FALSE)) == NULL) |
11436 { | 11436 { |
11437 EMSG(_(e_notmp)); | 11437 emsg(_(e_notmp)); |
11438 return NULL; | 11438 return NULL; |
11439 } | 11439 } |
11440 | 11440 |
11441 /* Add the redirection stuff */ | 11441 /* Add the redirection stuff */ |
11442 command = make_filter_cmd(cmd, infile, tempname); | 11442 command = make_filter_cmd(cmd, infile, tempname); |
11463 fd = mch_fopen((char *)tempname, READBIN); | 11463 fd = mch_fopen((char *)tempname, READBIN); |
11464 # endif | 11464 # endif |
11465 | 11465 |
11466 if (fd == NULL) | 11466 if (fd == NULL) |
11467 { | 11467 { |
11468 EMSG2(_(e_notopen), tempname); | 11468 semsg(_(e_notopen), tempname); |
11469 goto done; | 11469 goto done; |
11470 } | 11470 } |
11471 | 11471 |
11472 fseek(fd, 0L, SEEK_END); | 11472 fseek(fd, 0L, SEEK_END); |
11473 len = ftell(fd); /* get size of temp file */ | 11473 len = ftell(fd); /* get size of temp file */ |
11483 #ifdef VMS | 11483 #ifdef VMS |
11484 len = i; /* VMS doesn't give us what we asked for... */ | 11484 len = i; /* VMS doesn't give us what we asked for... */ |
11485 #endif | 11485 #endif |
11486 if (i != len) | 11486 if (i != len) |
11487 { | 11487 { |
11488 EMSG2(_(e_notread), tempname); | 11488 semsg(_(e_notread), tempname); |
11489 VIM_CLEAR(buffer); | 11489 VIM_CLEAR(buffer); |
11490 } | 11490 } |
11491 else if (ret_len == NULL) | 11491 else if (ret_len == NULL) |
11492 { | 11492 { |
11493 /* Change NUL into SOH, otherwise the string is truncated. */ | 11493 /* Change NUL into SOH, otherwise the string is truncated. */ |