diff options
| author | Paul Eggert | 2016-04-04 10:30:41 -0700 |
|---|---|---|
| committer | Paul Eggert | 2016-04-04 10:31:25 -0700 |
| commit | 17cb263adb7c37803140604f0a2e4df8a38fbcff (patch) | |
| tree | bd57929386123132847718e2d30a528c8b19d1a3 | |
| parent | 0322457e2bec0b9409a03887a8235dbe14e357f4 (diff) | |
| download | emacs-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.
| -rw-r--r-- | src/alloc.c | 15 | ||||
| -rw-r--r-- | src/coding.c | 9 | ||||
| -rw-r--r-- | src/editfns.c | 7 | ||||
| -rw-r--r-- | src/emacs-module.c | 20 | ||||
| -rw-r--r-- | src/fileio.c | 14 | ||||
| -rw-r--r-- | src/fns.c | 5 | ||||
| -rw-r--r-- | src/font.c | 3 | ||||
| -rw-r--r-- | src/ftfont.c | 5 | ||||
| -rw-r--r-- | src/keymap.c | 2 | ||||
| -rw-r--r-- | src/lisp.h | 28 | ||||
| -rw-r--r-- | src/menu.c | 2 | ||||
| -rw-r--r-- | src/sysdep.c | 30 |
12 files changed, 63 insertions, 77 deletions
diff --git a/src/alloc.c b/src/alloc.c index 56a535411c8..c5a4f425f6e 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -7216,21 +7216,6 @@ die (const char *msg, const char *file, int line) | |||
| 7216 | 7216 | ||
| 7217 | #if defined (ENABLE_CHECKING) && USE_STACK_LISP_OBJECTS | 7217 | #if defined (ENABLE_CHECKING) && USE_STACK_LISP_OBJECTS |
| 7218 | 7218 | ||
| 7219 | /* Debugging check whether STR is ASCII-only. */ | ||
| 7220 | |||
| 7221 | const char * | ||
| 7222 | verify_ascii (const char *str) | ||
| 7223 | { | ||
| 7224 | const unsigned char *ptr = (unsigned char *) str, *end = ptr + strlen (str); | ||
| 7225 | while (ptr < end) | ||
| 7226 | { | ||
| 7227 | int c = STRING_CHAR_ADVANCE (ptr); | ||
| 7228 | if (!ASCII_CHAR_P (c)) | ||
| 7229 | emacs_abort (); | ||
| 7230 | } | ||
| 7231 | return str; | ||
| 7232 | } | ||
| 7233 | |||
| 7234 | /* Stress alloca with inconveniently sized requests and check | 7219 | /* Stress alloca with inconveniently sized requests and check |
| 7235 | whether all allocated areas may be used for Lisp_Object. */ | 7220 | whether all allocated areas may be used for Lisp_Object. */ |
| 7236 | 7221 | ||
diff --git a/src/coding.c b/src/coding.c index e72d7b71867..bcedd7f5eeb 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -8419,11 +8419,10 @@ from_unicode (Lisp_Object str) | |||
| 8419 | Lisp_Object | 8419 | Lisp_Object |
| 8420 | from_unicode_buffer (const wchar_t *wstr) | 8420 | from_unicode_buffer (const wchar_t *wstr) |
| 8421 | { | 8421 | { |
| 8422 | return from_unicode ( | 8422 | /* We get one of the two final null bytes for free. */ |
| 8423 | make_unibyte_string ( | 8423 | prtdiff_t len = 1 + sizeof (wchar_t) * wcslen (wstr); |
| 8424 | (char *) wstr, | 8424 | AUTO_STRING_WITH_LEN (str, (char *) wstr, len); |
| 8425 | /* we get one of the two final 0 bytes for free. */ | 8425 | return from_unicode (str); |
| 8426 | 1 + sizeof (wchar_t) * wcslen (wstr))); | ||
| 8427 | } | 8426 | } |
| 8428 | 8427 | ||
| 8429 | wchar_t * | 8428 | wchar_t * |
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 | ||
| 2082 | DEFUN ("decode-time", Fdecode_time, Sdecode_time, 0, 2, 0, | 2083 | DEFUN ("decode-time", Fdecode_time, Sdecode_time, 0, 2, 0, |
diff --git a/src/emacs-module.c b/src/emacs-module.c index b57636e54e5..724d24a7768 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c | |||
| @@ -395,11 +395,13 @@ module_make_function (emacs_env *env, ptrdiff_t min_arity, ptrdiff_t max_arity, | |||
| 395 | envptr->data = data; | 395 | envptr->data = data; |
| 396 | 396 | ||
| 397 | Lisp_Object envobj = make_save_ptr (envptr); | 397 | Lisp_Object envobj = make_save_ptr (envptr); |
| 398 | Lisp_Object doc | 398 | Lisp_Object doc = Qnil; |
| 399 | = (documentation | 399 | if (documentation) |
| 400 | ? code_convert_string_norecord (build_unibyte_string (documentation), | 400 | { |
| 401 | Qutf_8, false) | 401 | AUTO_STRING (unibyte_doc, documentation); |
| 402 | : Qnil); | 402 | doc = code_convert_string_norecord (unibyte_doc, Qutf_8, false); |
| 403 | } | ||
| 404 | |||
| 403 | /* FIXME: Use a bytecompiled object, or even better a subr. */ | 405 | /* FIXME: Use a bytecompiled object, or even better a subr. */ |
| 404 | Lisp_Object ret = list4 (Qlambda, | 406 | Lisp_Object ret = list4 (Qlambda, |
| 405 | list2 (Qand_rest, Qargs), | 407 | list2 (Qand_rest, Qargs), |
| @@ -537,7 +539,7 @@ static emacs_value | |||
| 537 | module_make_string (emacs_env *env, const char *str, ptrdiff_t length) | 539 | module_make_string (emacs_env *env, const char *str, ptrdiff_t length) |
| 538 | { | 540 | { |
| 539 | MODULE_FUNCTION_BEGIN (module_nil); | 541 | MODULE_FUNCTION_BEGIN (module_nil); |
| 540 | Lisp_Object lstr = make_unibyte_string (str, length); | 542 | AUTO_STRING_WITH_LEN (lstr, str, length); |
| 541 | return lisp_to_value (code_convert_string_norecord (lstr, Qutf_8, false)); | 543 | return lisp_to_value (code_convert_string_norecord (lstr, Qutf_8, false)); |
| 542 | } | 544 | } |
| 543 | 545 | ||
| @@ -992,10 +994,12 @@ module_format_fun_env (const struct module_fun_env *env) | |||
| 992 | ? exprintf (&buf, &bufsize, buffer, -1, | 994 | ? exprintf (&buf, &bufsize, buffer, -1, |
| 993 | "#<module function %s from %s>", sym, path) | 995 | "#<module function %s from %s>", sym, path) |
| 994 | : sprintf (buffer, noaddr_format, env->subr)); | 996 | : sprintf (buffer, noaddr_format, env->subr)); |
| 995 | Lisp_Object unibyte_result = make_unibyte_string (buffer, size); | 997 | AUTO_STRING_WITH_LEN (unibyte_result, buffer, size); |
| 998 | Lisp_Object result = code_convert_string_norecord (unibyte_result, | ||
| 999 | Qutf_8, false); | ||
| 996 | if (buf != buffer) | 1000 | if (buf != buffer) |
| 997 | xfree (buf); | 1001 | xfree (buf); |
| 998 | return code_convert_string_norecord (unibyte_result, Qutf_8, false); | 1002 | return result; |
| 999 | } | 1003 | } |
| 1000 | 1004 | ||
| 1001 | 1005 | ||
diff --git a/src/fileio.c b/src/fileio.c index dfab3de9e94..0a14d64456b 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -187,9 +187,9 @@ report_file_errno (char const *string, Lisp_Object name, int errorno) | |||
| 187 | Lisp_Object data = CONSP (name) || NILP (name) ? name : list1 (name); | 187 | Lisp_Object data = CONSP (name) || NILP (name) ? name : list1 (name); |
| 188 | synchronize_system_messages_locale (); | 188 | synchronize_system_messages_locale (); |
| 189 | char *str = strerror (errorno); | 189 | char *str = strerror (errorno); |
| 190 | AUTO_STRING (unibyte_str, str); | ||
| 190 | Lisp_Object errstring | 191 | Lisp_Object errstring |
| 191 | = code_convert_string_norecord (build_unibyte_string (str), | 192 | = code_convert_string_norecord (unibyte_str, Vlocale_coding_system, 0); |
| 192 | Vlocale_coding_system, 0); | ||
| 193 | Lisp_Object errdata = Fcons (errstring, data); | 193 | Lisp_Object errdata = Fcons (errstring, data); |
| 194 | 194 | ||
| 195 | if (errorno == EEXIST) | 195 | if (errorno == EEXIST) |
| @@ -217,9 +217,9 @@ report_file_notify_error (const char *string, Lisp_Object name) | |||
| 217 | Lisp_Object data = CONSP (name) || NILP (name) ? name : list1 (name); | 217 | Lisp_Object data = CONSP (name) || NILP (name) ? name : list1 (name); |
| 218 | synchronize_system_messages_locale (); | 218 | synchronize_system_messages_locale (); |
| 219 | char *str = strerror (errno); | 219 | char *str = strerror (errno); |
| 220 | AUTO_STRING (unibyte_str, str); | ||
| 220 | Lisp_Object errstring | 221 | Lisp_Object errstring |
| 221 | = code_convert_string_norecord (build_unibyte_string (str), | 222 | = code_convert_string_norecord (unibyte_str, Vlocale_coding_system, 0); |
| 222 | Vlocale_coding_system, 0); | ||
| 223 | Lisp_Object errdata = Fcons (errstring, data); | 223 | Lisp_Object errdata = Fcons (errstring, data); |
| 224 | 224 | ||
| 225 | xsignal (Qfile_notify_error, Fcons (build_string (string), errdata)); | 225 | xsignal (Qfile_notify_error, Fcons (build_string (string), errdata)); |
| @@ -1015,11 +1015,9 @@ filesystem tree, not (expand-file-name ".." dirname). */) | |||
| 1015 | /* Drive must be set, so this is okay. */ | 1015 | /* Drive must be set, so this is okay. */ |
| 1016 | if (strcmp (nm - 2, SSDATA (name)) != 0) | 1016 | if (strcmp (nm - 2, SSDATA (name)) != 0) |
| 1017 | { | 1017 | { |
| 1018 | char temp[] = " :"; | ||
| 1019 | |||
| 1020 | name = make_specified_string (nm, -1, p - nm, multibyte); | 1018 | name = make_specified_string (nm, -1, p - nm, multibyte); |
| 1021 | temp[0] = DRIVE_LETTER (drive); | 1019 | char temp[] = { DRIVE_LETTER (drive), ':', 0 }; |
| 1022 | AUTO_STRING (drive_prefix, temp); | 1020 | AUTO_STRING_WITH_LEN (drive_prefix, temp, 2); |
| 1023 | name = concat2 (drive_prefix, name); | 1021 | name = concat2 (drive_prefix, name); |
| 1024 | } | 1022 | } |
| 1025 | #ifdef WINDOWSNT | 1023 | #ifdef WINDOWSNT |
| @@ -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 | } |
diff --git a/src/font.c b/src/font.c index 2519599bc63..6dbda40d52f 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -1771,7 +1771,8 @@ font_parse_family_registry (Lisp_Object family, Lisp_Object registry, Lisp_Objec | |||
| 1771 | p1 = strchr (p0, '-'); | 1771 | p1 = strchr (p0, '-'); |
| 1772 | if (! p1) | 1772 | if (! p1) |
| 1773 | { | 1773 | { |
| 1774 | AUTO_STRING (extra, (&"*-*"[len && p0[len - 1] == '*'])); | 1774 | bool asterisk = len && p0[len - 1] == '*'; |
| 1775 | AUTO_STRING_WITH_LEN (extra, &"*-*"[asterisk], 3 - asterisk); | ||
| 1775 | registry = concat2 (registry, extra); | 1776 | registry = concat2 (registry, extra); |
| 1776 | } | 1777 | } |
| 1777 | registry = Fdowncase (registry); | 1778 | registry = Fdowncase (registry); |
diff --git a/src/ftfont.c b/src/ftfont.c index 7285aee9bd4..1ae3f88daa3 100644 --- a/src/ftfont.c +++ b/src/ftfont.c | |||
| @@ -568,7 +568,6 @@ ftfont_get_charset (Lisp_Object registry) | |||
| 568 | char *str = SSDATA (SYMBOL_NAME (registry)); | 568 | char *str = SSDATA (SYMBOL_NAME (registry)); |
| 569 | USE_SAFE_ALLOCA; | 569 | USE_SAFE_ALLOCA; |
| 570 | char *re = SAFE_ALLOCA (SBYTES (SYMBOL_NAME (registry)) * 2 + 1); | 570 | char *re = SAFE_ALLOCA (SBYTES (SYMBOL_NAME (registry)) * 2 + 1); |
| 571 | Lisp_Object regexp; | ||
| 572 | int i, j; | 571 | int i, j; |
| 573 | 572 | ||
| 574 | for (i = j = 0; i < SBYTES (SYMBOL_NAME (registry)); i++, j++) | 573 | for (i = j = 0; i < SBYTES (SYMBOL_NAME (registry)); i++, j++) |
| @@ -582,13 +581,13 @@ ftfont_get_charset (Lisp_Object registry) | |||
| 582 | re[j] = '.'; | 581 | re[j] = '.'; |
| 583 | } | 582 | } |
| 584 | re[j] = '\0'; | 583 | re[j] = '\0'; |
| 585 | regexp = make_unibyte_string (re, j); | 584 | AUTO_STRING_WITH_LEN (regexp, re, j); |
| 586 | SAFE_FREE (); | ||
| 587 | for (i = 0; fc_charset_table[i].name; i++) | 585 | for (i = 0; fc_charset_table[i].name; i++) |
| 588 | if (fast_c_string_match_ignore_case | 586 | if (fast_c_string_match_ignore_case |
| 589 | (regexp, fc_charset_table[i].name, | 587 | (regexp, fc_charset_table[i].name, |
| 590 | strlen (fc_charset_table[i].name)) >= 0) | 588 | strlen (fc_charset_table[i].name)) >= 0) |
| 591 | break; | 589 | break; |
| 590 | SAFE_FREE (); | ||
| 592 | if (! fc_charset_table[i].name) | 591 | if (! fc_charset_table[i].name) |
| 593 | return -1; | 592 | return -1; |
| 594 | if (! fc_charset_table[i].fc_charset) | 593 | if (! fc_charset_table[i].fc_charset) |
diff --git a/src/keymap.c b/src/keymap.c index 8ab4c6c27ae..eef1dcd39e5 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -1303,7 +1303,7 @@ silly_event_symbol_error (Lisp_Object c) | |||
| 1303 | *p = 0; | 1303 | *p = 0; |
| 1304 | 1304 | ||
| 1305 | c = reorder_modifiers (c); | 1305 | c = reorder_modifiers (c); |
| 1306 | AUTO_STRING (new_mods_string, new_mods); | 1306 | AUTO_STRING_WITH_LEN (new_mods_string, new_mods, p - new_mods); |
| 1307 | keystring = concat2 (new_mods_string, XCDR (assoc)); | 1307 | keystring = concat2 (new_mods_string, XCDR (assoc)); |
| 1308 | 1308 | ||
| 1309 | error ("To bind the key %s, use [?%s], not [%s]", | 1309 | error ("To bind the key %s, use [?%s], not [%s]", |
diff --git a/src/lisp.h b/src/lisp.h index 65335fbc052..170da67c61c 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -4609,27 +4609,29 @@ enum | |||
| 4609 | STACK_CONS (d, Qnil)))) \ | 4609 | STACK_CONS (d, Qnil)))) \ |
| 4610 | : list4 (a, b, c, d)) | 4610 | : list4 (a, b, c, d)) |
| 4611 | 4611 | ||
| 4612 | /* Check whether stack-allocated strings are ASCII-only. */ | 4612 | /* Declare NAME as an auto Lisp string if possible, a GC-based one if not. |
| 4613 | Take its unibyte value from the null-terminated string STR, | ||
| 4614 | an expression that should not have side effects. | ||
| 4615 | STR's value is not necessarily copied. The resulting Lisp string | ||
| 4616 | should not be modified or made visible to user code. */ | ||
| 4613 | 4617 | ||
| 4614 | #if defined (ENABLE_CHECKING) && USE_STACK_LISP_OBJECTS | 4618 | #define AUTO_STRING(name, str) \ |
| 4615 | extern const char *verify_ascii (const char *); | 4619 | AUTO_STRING_WITH_LEN (name, str, strlen (str)) |
| 4616 | #else | ||
| 4617 | # define verify_ascii(str) (str) | ||
| 4618 | #endif | ||
| 4619 | 4620 | ||
| 4620 | /* Declare NAME as an auto Lisp string if possible, a GC-based one if not. | 4621 | /* Declare NAME as an auto Lisp string if possible, a GC-based one if not. |
| 4621 | Take its value from STR. STR is not necessarily copied and should | 4622 | Take its unibyte value from the null-terminated string STR with length LEN. |
| 4622 | contain only ASCII characters. The resulting Lisp string should | 4623 | STR may have side effects and may contain null bytes. |
| 4623 | not be modified or made visible to user code. */ | 4624 | STR's value is not necessarily copied. The resulting Lisp string |
| 4625 | should not be modified or made visible to user code. */ | ||
| 4624 | 4626 | ||
| 4625 | #define AUTO_STRING(name, str) \ | 4627 | #define AUTO_STRING_WITH_LEN(name, str, len) \ |
| 4626 | Lisp_Object name = \ | 4628 | Lisp_Object name = \ |
| 4627 | (USE_STACK_STRING \ | 4629 | (USE_STACK_STRING \ |
| 4628 | ? (make_lisp_ptr \ | 4630 | ? (make_lisp_ptr \ |
| 4629 | ((&(union Aligned_String) \ | 4631 | ((&(union Aligned_String) \ |
| 4630 | {{strlen (str), -1, 0, (unsigned char *) verify_ascii (str)}}.s), \ | 4632 | {{len, -1, 0, (unsigned char *) (str)}}.s), \ |
| 4631 | Lisp_String)) \ | 4633 | Lisp_String)) \ |
| 4632 | : build_string (verify_ascii (str))) | 4634 | : make_unibyte_string (str, len)) |
| 4633 | 4635 | ||
| 4634 | /* Loop over all tails of a list, checking for cycles. | 4636 | /* Loop over all tails of a list, checking for cycles. |
| 4635 | FIXME: Make tortoise and n internal declarations. | 4637 | FIXME: Make tortoise and n internal declarations. |
diff --git a/src/menu.c b/src/menu.c index 9504cee5923..737f2b55e8b 100644 --- a/src/menu.c +++ b/src/menu.c | |||
| @@ -408,7 +408,7 @@ single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *sk | |||
| 408 | 408 | ||
| 409 | if (prefix) | 409 | if (prefix) |
| 410 | { | 410 | { |
| 411 | AUTO_STRING (prefix_obj, prefix); | 411 | AUTO_STRING_WITH_LEN (prefix_obj, prefix, 4); |
| 412 | item_string = concat2 (prefix_obj, item_string); | 412 | item_string = concat2 (prefix_obj, item_string); |
| 413 | } | 413 | } |
| 414 | } | 414 | } |
diff --git a/src/sysdep.c b/src/sysdep.c index 67c9bd90df7..1e3b9f12128 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -3050,7 +3050,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 3050 | struct timespec tnow, tstart, tboot, telapsed, us_time; | 3050 | struct timespec tnow, tstart, tboot, telapsed, us_time; |
| 3051 | double pcpu, pmem; | 3051 | double pcpu, pmem; |
| 3052 | Lisp_Object attrs = Qnil; | 3052 | Lisp_Object attrs = Qnil; |
| 3053 | Lisp_Object cmd_str, decoded_cmd; | 3053 | Lisp_Object decoded_cmd; |
| 3054 | ptrdiff_t count; | 3054 | ptrdiff_t count; |
| 3055 | 3055 | ||
| 3056 | CHECK_NUMBER_OR_FLOAT (pid); | 3056 | CHECK_NUMBER_OR_FLOAT (pid); |
| @@ -3107,7 +3107,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 3107 | else | 3107 | else |
| 3108 | q = NULL; | 3108 | q = NULL; |
| 3109 | /* Command name is encoded in locale-coding-system; decode it. */ | 3109 | /* Command name is encoded in locale-coding-system; decode it. */ |
| 3110 | cmd_str = make_unibyte_string (cmd, cmdsize); | 3110 | AUTO_STRING_WITH_LEN (cmd_str, cmd, cmdsize); |
| 3111 | decoded_cmd = code_convert_string_norecord (cmd_str, | 3111 | decoded_cmd = code_convert_string_norecord (cmd_str, |
| 3112 | Vlocale_coding_system, 0); | 3112 | Vlocale_coding_system, 0); |
| 3113 | attrs = Fcons (Fcons (Qcomm, decoded_cmd), attrs); | 3113 | attrs = Fcons (Fcons (Qcomm, decoded_cmd), attrs); |
| @@ -3240,7 +3240,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 3240 | sprintf (cmdline, "[%.*s]", cmdsize, cmd); | 3240 | sprintf (cmdline, "[%.*s]", cmdsize, cmd); |
| 3241 | } | 3241 | } |
| 3242 | /* Command line is encoded in locale-coding-system; decode it. */ | 3242 | /* Command line is encoded in locale-coding-system; decode it. */ |
| 3243 | cmd_str = make_unibyte_string (q, nread); | 3243 | AUTO_STRING_WITH_LEN (cmd_str, q, nread); |
| 3244 | decoded_cmd = code_convert_string_norecord (cmd_str, | 3244 | decoded_cmd = code_convert_string_norecord (cmd_str, |
| 3245 | Vlocale_coding_system, 0); | 3245 | Vlocale_coding_system, 0); |
| 3246 | unbind_to (count, Qnil); | 3246 | unbind_to (count, Qnil); |
| @@ -3375,13 +3375,13 @@ system_process_attributes (Lisp_Object pid) | |||
| 3375 | make_float (100.0 / 0x8000 * pinfo.pr_pctmem)), | 3375 | make_float (100.0 / 0x8000 * pinfo.pr_pctmem)), |
| 3376 | attrs); | 3376 | attrs); |
| 3377 | 3377 | ||
| 3378 | decoded_cmd = (code_convert_string_norecord | 3378 | AUTO_STRING (fname, pinfo.pr_fname); |
| 3379 | (build_unibyte_string (pinfo.pr_fname), | 3379 | decoded_cmd = code_convert_string_norecord (fname, |
| 3380 | Vlocale_coding_system, 0)); | 3380 | Vlocale_coding_system, 0); |
| 3381 | attrs = Fcons (Fcons (Qcomm, decoded_cmd), attrs); | 3381 | attrs = Fcons (Fcons (Qcomm, decoded_cmd), attrs); |
| 3382 | decoded_cmd = (code_convert_string_norecord | 3382 | AUTO_STRING (psargs, pinfo.pr_psargs); |
| 3383 | (build_unibyte_string (pinfo.pr_psargs), | 3383 | decoded_cmd = code_convert_string_norecord (psargs, |
| 3384 | Vlocale_coding_system, 0)); | 3384 | Vlocale_coding_system, 0); |
| 3385 | attrs = Fcons (Fcons (Qargs, decoded_cmd), attrs); | 3385 | attrs = Fcons (Fcons (Qargs, decoded_cmd), attrs); |
| 3386 | } | 3386 | } |
| 3387 | unbind_to (count, Qnil); | 3387 | unbind_to (count, Qnil); |
| @@ -3446,9 +3446,8 @@ system_process_attributes (Lisp_Object pid) | |||
| 3446 | if (gr) | 3446 | if (gr) |
| 3447 | attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs); | 3447 | attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs); |
| 3448 | 3448 | ||
| 3449 | decoded_comm = (code_convert_string_norecord | 3449 | AUTO_STRING (comm, proc.ki_comm); |
| 3450 | (build_unibyte_string (proc.ki_comm), | 3450 | decoded_comm = code_convert_string_norecord (comm, Vlocale_coding_system, 0); |
| 3451 | Vlocale_coding_system, 0)); | ||
| 3452 | 3451 | ||
| 3453 | attrs = Fcons (Fcons (Qcomm, decoded_comm), attrs); | 3452 | attrs = Fcons (Fcons (Qcomm, decoded_comm), attrs); |
| 3454 | { | 3453 | { |
| @@ -3559,10 +3558,9 @@ system_process_attributes (Lisp_Object pid) | |||
| 3559 | args[i] = ' '; | 3558 | args[i] = ' '; |
| 3560 | } | 3559 | } |
| 3561 | 3560 | ||
| 3562 | decoded_comm = | 3561 | AUTO_STRING (comm, args); |
| 3563 | (code_convert_string_norecord | 3562 | decoded_comm = code_convert_string_norecord (comm, |
| 3564 | (build_unibyte_string (args), | 3563 | Vlocale_coding_system, 0); |
| 3565 | Vlocale_coding_system, 0)); | ||
| 3566 | 3564 | ||
| 3567 | attrs = Fcons (Fcons (Qargs, decoded_comm), attrs); | 3565 | attrs = Fcons (Fcons (Qargs, decoded_comm), attrs); |
| 3568 | } | 3566 | } |