Mercurial > vim
comparison src/if_perl.xs @ 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 | 0fcc1315c061 |
comparison
equal
deleted
inserted
replaced
15469:bc9b5261ed01 | 15470:55ccc2d353bd |
---|---|
693 if (hPerlLib != NULL) | 693 if (hPerlLib != NULL) |
694 return OK; | 694 return OK; |
695 if ((hPerlLib = load_dll(libname)) == NULL) | 695 if ((hPerlLib = load_dll(libname)) == NULL) |
696 { | 696 { |
697 if (verbose) | 697 if (verbose) |
698 EMSG2(_("E370: Could not load library %s"), libname); | 698 semsg(_("E370: Could not load library %s"), libname); |
699 return FAIL; | 699 return FAIL; |
700 } | 700 } |
701 for (i = 0; perl_funcname_table[i].ptr; ++i) | 701 for (i = 0; perl_funcname_table[i].ptr; ++i) |
702 { | 702 { |
703 if (!(*perl_funcname_table[i].ptr = symbol_from_dll(hPerlLib, | 703 if (!(*perl_funcname_table[i].ptr = symbol_from_dll(hPerlLib, |
704 perl_funcname_table[i].name))) | 704 perl_funcname_table[i].name))) |
705 { | 705 { |
706 close_dll(hPerlLib); | 706 close_dll(hPerlLib); |
707 hPerlLib = NULL; | 707 hPerlLib = NULL; |
708 if (verbose) | 708 if (verbose) |
709 EMSG2(_(e_loadfunc), perl_funcname_table[i].name); | 709 semsg((const char *)_(e_loadfunc), perl_funcname_table[i].name); |
710 return FAIL; | 710 return FAIL; |
711 } | 711 } |
712 } | 712 } |
713 return OK; | 713 return OK; |
714 } | 714 } |
996 if (perl_interp == NULL) | 996 if (perl_interp == NULL) |
997 { | 997 { |
998 #ifdef DYNAMIC_PERL | 998 #ifdef DYNAMIC_PERL |
999 if (!perl_enabled(TRUE)) | 999 if (!perl_enabled(TRUE)) |
1000 { | 1000 { |
1001 EMSG(_(e_noperl)); | 1001 emsg(_(e_noperl)); |
1002 vim_free(script); | 1002 vim_free(script); |
1003 return; | 1003 return; |
1004 } | 1004 } |
1005 #endif | 1005 #endif |
1006 perl_init(); | 1006 perl_init(); |
1023 if (sandbox) | 1023 if (sandbox) |
1024 { | 1024 { |
1025 safe = perl_get_sv("VIM::safe", FALSE); | 1025 safe = perl_get_sv("VIM::safe", FALSE); |
1026 # ifndef MAKE_TEST /* avoid a warning for unreachable code */ | 1026 # ifndef MAKE_TEST /* avoid a warning for unreachable code */ |
1027 if (safe == NULL || !SvTRUE(safe)) | 1027 if (safe == NULL || !SvTRUE(safe)) |
1028 EMSG(_("E299: Perl evaluation forbidden in sandbox without the Safe module")); | 1028 emsg(_("E299: Perl evaluation forbidden in sandbox without the Safe module")); |
1029 else | 1029 else |
1030 # endif | 1030 # endif |
1031 { | 1031 { |
1032 PUSHMARK(SP); | 1032 PUSHMARK(SP); |
1033 XPUSHs(safe); | 1033 XPUSHs(safe); |
1233 { | 1233 { |
1234 key_len = 0; | 1234 key_len = 0; |
1235 key = hv_iterkey(entry, &key_len); | 1235 key = hv_iterkey(entry, &key_len); |
1236 | 1236 |
1237 if (!key || !key_len || strlen(key) < (size_t)key_len) { | 1237 if (!key || !key_len || strlen(key) < (size_t)key_len) { |
1238 EMSG2("Malformed key Dictionary '%s'", key && *key ? key : "(empty)"); | 1238 semsg("Malformed key Dictionary '%s'", key && *key ? key : "(empty)"); |
1239 break; | 1239 break; |
1240 } | 1240 } |
1241 | 1241 |
1242 if ((item = dictitem_alloc((char_u *)key)) == NULL) | 1242 if ((item = dictitem_alloc((char_u *)key)) == NULL) |
1243 break; | 1243 break; |
1284 if (perl_interp == NULL) | 1284 if (perl_interp == NULL) |
1285 { | 1285 { |
1286 #ifdef DYNAMIC_PERL | 1286 #ifdef DYNAMIC_PERL |
1287 if (!perl_enabled(TRUE)) | 1287 if (!perl_enabled(TRUE)) |
1288 { | 1288 { |
1289 EMSG(_(e_noperl)); | 1289 emsg(_(e_noperl)); |
1290 return; | 1290 return; |
1291 } | 1291 } |
1292 #endif | 1292 #endif |
1293 perl_init(); | 1293 perl_init(); |
1294 } | 1294 } |
1302 if (sandbox) | 1302 if (sandbox) |
1303 { | 1303 { |
1304 safe = get_sv("VIM::safe", FALSE); | 1304 safe = get_sv("VIM::safe", FALSE); |
1305 # ifndef MAKE_TEST /* avoid a warning for unreachable code */ | 1305 # ifndef MAKE_TEST /* avoid a warning for unreachable code */ |
1306 if (safe == NULL || !SvTRUE(safe)) | 1306 if (safe == NULL || !SvTRUE(safe)) |
1307 EMSG(_("E299: Perl evaluation forbidden in sandbox without the Safe module")); | 1307 emsg(_("E299: Perl evaluation forbidden in sandbox without the Safe module")); |
1308 else | 1308 else |
1309 # endif | 1309 # endif |
1310 { | 1310 { |
1311 sv = newSVpv((char *)str, 0); | 1311 sv = newSVpv((char *)str, 0); |
1312 PUSHMARK(SP); | 1312 PUSHMARK(SP); |
1354 if (perl_interp == NULL) | 1354 if (perl_interp == NULL) |
1355 { | 1355 { |
1356 #ifdef DYNAMIC_PERL | 1356 #ifdef DYNAMIC_PERL |
1357 if (!perl_enabled(TRUE)) | 1357 if (!perl_enabled(TRUE)) |
1358 { | 1358 { |
1359 EMSG(_(e_noperl)); | 1359 emsg(_(e_noperl)); |
1360 return; | 1360 return; |
1361 } | 1361 } |
1362 #endif | 1362 #endif |
1363 perl_init(); | 1363 perl_init(); |
1364 } | 1364 } |