comparison src/if_python3.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 1d2b5c016f17
children 7fad90423bd2
comparison
equal deleted inserted replaced
15469:bc9b5261ed01 15470:55ccc2d353bd
632 * It cause a crash, because RTLD_GLOBAL is needed for 632 * It cause a crash, because RTLD_GLOBAL is needed for
633 * standard C extension libraries of one or both python versions. */ 633 * standard C extension libraries of one or both python versions. */
634 if (python_loaded()) 634 if (python_loaded())
635 { 635 {
636 if (verbose) 636 if (verbose)
637 EMSG(_("E837: This Vim cannot execute :py3 after using :python")); 637 emsg(_("E837: This Vim cannot execute :py3 after using :python"));
638 return FAIL; 638 return FAIL;
639 } 639 }
640 # endif 640 # endif
641 641
642 if (hinstPy3 != 0) 642 if (hinstPy3 != 0)
644 hinstPy3 = load_dll(libname); 644 hinstPy3 = load_dll(libname);
645 645
646 if (!hinstPy3) 646 if (!hinstPy3)
647 { 647 {
648 if (verbose) 648 if (verbose)
649 EMSG2(_(e_loadlib), libname); 649 semsg(_(e_loadlib), libname);
650 return FAIL; 650 return FAIL;
651 } 651 }
652 652
653 for (i = 0; py3_funcname_table[i].ptr; ++i) 653 for (i = 0; py3_funcname_table[i].ptr; ++i)
654 { 654 {
656 py3_funcname_table[i].name)) == NULL) 656 py3_funcname_table[i].name)) == NULL)
657 { 657 {
658 close_dll(hinstPy3); 658 close_dll(hinstPy3);
659 hinstPy3 = 0; 659 hinstPy3 = 0;
660 if (verbose) 660 if (verbose)
661 EMSG2(_(e_loadfunc), py3_funcname_table[i].name); 661 semsg(_(e_loadfunc), py3_funcname_table[i].name);
662 return FAIL; 662 return FAIL;
663 } 663 }
664 } 664 }
665 665
666 /* Load unicode functions separately as only the ucs2 or the ucs4 functions 666 /* Load unicode functions separately as only the ucs2 or the ucs4 functions
691 || *ucs_as_encoded_string == NULL) 691 || *ucs_as_encoded_string == NULL)
692 { 692 {
693 close_dll(hinstPy3); 693 close_dll(hinstPy3);
694 hinstPy3 = 0; 694 hinstPy3 = 0;
695 if (verbose) 695 if (verbose)
696 EMSG2(_(e_loadfunc), "PyUnicode_UCSX_*"); 696 semsg(_(e_loadfunc), "PyUnicode_UCSX_*");
697 return FAIL; 697 return FAIL;
698 } 698 }
699 699
700 return OK; 700 return OK;
701 } 701 }
862 if (!py3initialised) 862 if (!py3initialised)
863 { 863 {
864 #ifdef DYNAMIC_PYTHON3 864 #ifdef DYNAMIC_PYTHON3
865 if (!python3_enabled(TRUE)) 865 if (!python3_enabled(TRUE))
866 { 866 {
867 EMSG(_("E263: Sorry, this command is disabled, the Python library could not be loaded.")); 867 emsg(_("E263: Sorry, this command is disabled, the Python library could not be loaded."));
868 goto fail; 868 goto fail;
869 } 869 }
870 #endif 870 #endif
871 871
872 init_structs(); 872 init_structs();