aboutsummaryrefslogtreecommitdiffstats
path: root/src/editfns.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/editfns.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/editfns.c')
-rw-r--r--src/editfns.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/editfns.c b/src/editfns.c
index 664a59e0721..a2d5673a257 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2042,7 +2042,6 @@ format_time_string (char const *format, ptrdiff_t formatlen,
2042 char *buf = buffer; 2042 char *buf = buffer;
2043 ptrdiff_t size = sizeof buffer; 2043 ptrdiff_t size = sizeof buffer;
2044 size_t len; 2044 size_t len;
2045 Lisp_Object bufstring;
2046 int ns = t.tv_nsec; 2045 int ns = t.tv_nsec;
2047 USE_SAFE_ALLOCA; 2046 USE_SAFE_ALLOCA;
2048 2047
@@ -2074,9 +2073,11 @@ format_time_string (char const *format, ptrdiff_t formatlen,
2074 } 2073 }
2075 2074
2076 xtzfree (tz); 2075 xtzfree (tz);
2077 bufstring = make_unibyte_string (buf, len); 2076 AUTO_STRING_WITH_LEN (bufstring, buf, len);
2077 Lisp_Object result = code_convert_string_norecord (bufstring,
2078 Vlocale_coding_system, 0);
2078 SAFE_FREE (); 2079 SAFE_FREE ();
2079 return code_convert_string_norecord (bufstring, Vlocale_coding_system, 0); 2080 return result;
2080} 2081}
2081 2082
2082DEFUN ("decode-time", Fdecode_time, Sdecode_time, 0, 2, 0, 2083DEFUN ("decode-time", Fdecode_time, Sdecode_time, 0, 2, 0,