comparison src/dict.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 762fccd84b7c
children 5b6c3c7feba8
comparison
equal deleted inserted replaced
15469:bc9b5261ed01 15470:55ccc2d353bd
642 { 642 {
643 if (eval1(arg, &tvkey, evaluate) == FAIL) /* recursive! */ 643 if (eval1(arg, &tvkey, evaluate) == FAIL) /* recursive! */
644 goto failret; 644 goto failret;
645 if (**arg != ':') 645 if (**arg != ':')
646 { 646 {
647 EMSG2(_("E720: Missing colon in Dictionary: %s"), *arg); 647 semsg(_("E720: Missing colon in Dictionary: %s"), *arg);
648 clear_tv(&tvkey); 648 clear_tv(&tvkey);
649 goto failret; 649 goto failret;
650 } 650 }
651 if (evaluate) 651 if (evaluate)
652 { 652 {
669 if (evaluate) 669 if (evaluate)
670 { 670 {
671 item = dict_find(d, key, -1); 671 item = dict_find(d, key, -1);
672 if (item != NULL) 672 if (item != NULL)
673 { 673 {
674 EMSG2(_("E721: Duplicate key in Dictionary: \"%s\""), key); 674 semsg(_("E721: Duplicate key in Dictionary: \"%s\""), key);
675 clear_tv(&tvkey); 675 clear_tv(&tvkey);
676 clear_tv(&tv); 676 clear_tv(&tv);
677 goto failret; 677 goto failret;
678 } 678 }
679 item = dictitem_alloc(key); 679 item = dictitem_alloc(key);
689 689
690 if (**arg == '}') 690 if (**arg == '}')
691 break; 691 break;
692 if (**arg != ',') 692 if (**arg != ',')
693 { 693 {
694 EMSG2(_("E722: Missing comma in Dictionary: %s"), *arg); 694 semsg(_("E722: Missing comma in Dictionary: %s"), *arg);
695 goto failret; 695 goto failret;
696 } 696 }
697 *arg = skipwhite(*arg + 1); 697 *arg = skipwhite(*arg + 1);
698 } 698 }
699 699
700 if (**arg != '}') 700 if (**arg != '}')
701 { 701 {
702 EMSG2(_("E723: Missing end of Dictionary '}': %s"), *arg); 702 semsg(_("E723: Missing end of Dictionary '}': %s"), *arg);
703 failret: 703 failret:
704 if (evaluate) 704 if (evaluate)
705 dict_free(d); 705 dict_free(d);
706 return FAIL; 706 return FAIL;
707 } 707 }
751 if (di1 != NULL && dict_add(d1, di1) == FAIL) 751 if (di1 != NULL && dict_add(d1, di1) == FAIL)
752 dictitem_free(di1); 752 dictitem_free(di1);
753 } 753 }
754 else if (*action == 'e') 754 else if (*action == 'e')
755 { 755 {
756 EMSG2(_("E737: Key already exists: %s"), hi2->hi_key); 756 semsg(_("E737: Key already exists: %s"), hi2->hi_key);
757 break; 757 break;
758 } 758 }
759 else if (*action == 'f' && HI2DI(hi2) != di1) 759 else if (*action == 'f' && HI2DI(hi2) != di1)
760 { 760 {
761 if (tv_check_lock(di1->di_tv.v_lock, arg_errmsg, TRUE) 761 if (tv_check_lock(di1->di_tv.v_lock, arg_errmsg, TRUE)
833 dict_T *d; 833 dict_T *d;
834 int todo; 834 int todo;
835 835
836 if (argvars[0].v_type != VAR_DICT) 836 if (argvars[0].v_type != VAR_DICT)
837 { 837 {
838 EMSG(_(e_dictreq)); 838 emsg(_(e_dictreq));
839 return; 839 return;
840 } 840 }
841 if ((d = argvars[0].vval.v_dict) == NULL) 841 if ((d = argvars[0].vval.v_dict) == NULL)
842 return; 842 return;
843 843