comparison src/digraph.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 1ef429366fd4
children 1ec942f1b648
comparison
equal deleted inserted replaced
15469:bc9b5261ed01 15470:55ccc2d353bd
2216 return; 2216 return;
2217 char1 = *str++; 2217 char1 = *str++;
2218 char2 = *str++; 2218 char2 = *str++;
2219 if (char2 == 0) 2219 if (char2 == 0)
2220 { 2220 {
2221 EMSG(_(e_invarg)); 2221 emsg(_(e_invarg));
2222 return; 2222 return;
2223 } 2223 }
2224 if (char1 == ESC || char2 == ESC) 2224 if (char1 == ESC || char2 == ESC)
2225 { 2225 {
2226 EMSG(_("E104: Escape not allowed in digraph")); 2226 emsg(_("E104: Escape not allowed in digraph"));
2227 return; 2227 return;
2228 } 2228 }
2229 str = skipwhite(str); 2229 str = skipwhite(str);
2230 if (!VIM_ISDIGIT(*str)) 2230 if (!VIM_ISDIGIT(*str))
2231 { 2231 {
2232 EMSG(_(e_number_exp)); 2232 emsg(_(e_number_exp));
2233 return; 2233 return;
2234 } 2234 }
2235 n = getdigits(&str); 2235 n = getdigits(&str);
2236 2236
2237 /* If the digraph already exists, replace the result. */ 2237 /* If the digraph already exists, replace the result. */
2444 * Set up key mapping tables for the 'keymap' option. 2444 * Set up key mapping tables for the 'keymap' option.
2445 * Returns NULL if OK, an error message for failure. This only needs to be 2445 * Returns NULL if OK, an error message for failure. This only needs to be
2446 * used when setting the option, not later when the value has already been 2446 * used when setting the option, not later when the value has already been
2447 * checked. 2447 * checked.
2448 */ 2448 */
2449 char_u * 2449 char *
2450 keymap_init(void) 2450 keymap_init(void)
2451 { 2451 {
2452 curbuf->b_kmap_state &= ~KEYMAP_INIT; 2452 curbuf->b_kmap_state &= ~KEYMAP_INIT;
2453 2453
2454 if (*curbuf->b_p_keymap == NUL) 2454 if (*curbuf->b_p_keymap == NUL)
2485 vim_snprintf((char *)buf, buflen, "keymap/%s.vim", 2485 vim_snprintf((char *)buf, buflen, "keymap/%s.vim",
2486 curbuf->b_p_keymap); 2486 curbuf->b_p_keymap);
2487 if (source_runtime(buf, 0) == FAIL) 2487 if (source_runtime(buf, 0) == FAIL)
2488 { 2488 {
2489 vim_free(buf); 2489 vim_free(buf);
2490 return (char_u *)N_("E544: Keymap file not found"); 2490 return N_("E544: Keymap file not found");
2491 } 2491 }
2492 } 2492 }
2493 vim_free(buf); 2493 vim_free(buf);
2494 } 2494 }
2495 2495
2511 int i; 2511 int i;
2512 char_u *save_cpo = p_cpo; 2512 char_u *save_cpo = p_cpo;
2513 2513
2514 if (!getline_equal(eap->getline, eap->cookie, getsourceline)) 2514 if (!getline_equal(eap->getline, eap->cookie, getsourceline))
2515 { 2515 {
2516 EMSG(_("E105: Using :loadkeymap not in a sourced file")); 2516 emsg(_("E105: Using :loadkeymap not in a sourced file"));
2517 return; 2517 return;
2518 } 2518 }
2519 2519
2520 /* 2520 /*
2521 * Stop any active keymap and clear the table. 2521 * Stop any active keymap and clear the table.
2550 if (kp->from == NULL || kp->to == NULL 2550 if (kp->from == NULL || kp->to == NULL
2551 || STRLEN(kp->from) + STRLEN(kp->to) >= KMAP_LLEN 2551 || STRLEN(kp->from) + STRLEN(kp->to) >= KMAP_LLEN
2552 || *kp->from == NUL || *kp->to == NUL) 2552 || *kp->from == NUL || *kp->to == NUL)
2553 { 2553 {
2554 if (kp->to != NULL && *kp->to == NUL) 2554 if (kp->to != NULL && *kp->to == NUL)
2555 EMSG(_("E791: Empty keymap entry")); 2555 emsg(_("E791: Empty keymap entry"));
2556 vim_free(kp->from); 2556 vim_free(kp->from);
2557 vim_free(kp->to); 2557 vim_free(kp->to);
2558 } 2558 }
2559 else 2559 else
2560 ++curbuf->b_kmap_ga.ga_len; 2560 ++curbuf->b_kmap_ga.ga_len;