aboutsummaryrefslogtreecommitdiffstats
path: root/src/fns.c
diff options
context:
space:
mode:
authorPaul Eggert2016-04-04 10:30:41 -0700
committerPaul Eggert2016-04-04 10:31:25 -0700
commit17cb263adb7c37803140604f0a2e4df8a38fbcff (patch)
treebd57929386123132847718e2d30a528c8b19d1a3 /src/fns.c
parent0322457e2bec0b9409a03887a8235dbe14e357f4 (diff)
downloademacs-17cb263adb7c37803140604f0a2e4df8a38fbcff.tar.gz
emacs-17cb263adb7c37803140604f0a2e4df8a38fbcff.zip
New C macro AUTO_STRING_WITH_LEN
Put a bit less pressure on the garbage collector by defining a macro that is like AUTO_STRING but also allows null bytes in strings, and by extending AUTO_STRING to work with any unibyte string. * src/alloc.c (verify_ascii): Remove; all uses removed. AUTO_STRING can now be used on non-ASCII unibyte strings. * src/lisp.h (AUTO_STRING): Now allows non-ASCII unibyte strings. (AUTO_STRING_WITH_LEN): New macro. * src/coding.c (from_unicode_buffer): * src/editfns.c (format_time_string): * src/emacs-module.c (module_make_string, module_format_fun_env): * src/fileio.c (Fexpand_file_name): * src/font.c (font_parse_family_registry): * src/ftfont.c (ftfont_get_charset): * src/keymap.c (silly_event_symbol_error): * src/menu.c (single_menu_item): * src/sysdep.c (system_process_attributes): Use AUTO_STRING_WITH_LEN if possible. * src/emacs-module.c (module_make_function): * src/fileio.c (report_file_errno, report_file_notify_error): * src/fns.c (Flocale_info): * src/sysdep.c (system_process_attributes): Use AUTO_STRING if possible. This is doable more often now that AUTO_STRING works on any unibyte string.
Diffstat (limited to 'src/fns.c')
-rw-r--r--src/fns.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/fns.c b/src/fns.c
index 114a556612a..1ace3bb888e 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2999,7 +2999,6 @@ The data read from the system are decoded using `locale-coding-system'. */)
2999{ 2999{
3000 char *str = NULL; 3000 char *str = NULL;
3001#ifdef HAVE_LANGINFO_CODESET 3001#ifdef HAVE_LANGINFO_CODESET
3002 Lisp_Object val;
3003 if (EQ (item, Qcodeset)) 3002 if (EQ (item, Qcodeset))
3004 { 3003 {
3005 str = nl_langinfo (CODESET); 3004 str = nl_langinfo (CODESET);
@@ -3015,7 +3014,7 @@ The data read from the system are decoded using `locale-coding-system'. */)
3015 for (i = 0; i < 7; i++) 3014 for (i = 0; i < 7; i++)
3016 { 3015 {
3017 str = nl_langinfo (days[i]); 3016 str = nl_langinfo (days[i]);
3018 val = build_unibyte_string (str); 3017 AUTO_STRING (val, str);
3019 /* Fixme: Is this coding system necessarily right, even if 3018 /* Fixme: Is this coding system necessarily right, even if
3020 it is consistent with CODESET? If not, what to do? */ 3019 it is consistent with CODESET? If not, what to do? */
3021 ASET (v, i, code_convert_string_norecord (val, Vlocale_coding_system, 3020 ASET (v, i, code_convert_string_norecord (val, Vlocale_coding_system,
@@ -3035,7 +3034,7 @@ The data read from the system are decoded using `locale-coding-system'. */)
3035 for (i = 0; i < 12; i++) 3034 for (i = 0; i < 12; i++)
3036 { 3035 {
3037 str = nl_langinfo (months[i]); 3036 str = nl_langinfo (months[i]);
3038 val = build_unibyte_string (str); 3037 AUTO_STRING (val, str);
3039 ASET (v, i, code_convert_string_norecord (val, Vlocale_coding_system, 3038 ASET (v, i, code_convert_string_norecord (val, Vlocale_coding_system,
3040 0)); 3039 0));
3041 } 3040 }