diff options
| author | Dmitry Antipov | 2012-07-10 12:43:46 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-07-10 12:43:46 +0400 |
| commit | 2a0213a6d0a9e36a388994445837e051d0bbe5f9 (patch) | |
| tree | b7e4d5c2ef5d4061e083ef2123c1fc72ad46d93d /src | |
| parent | cb1caeaf2ba26df05e8f9bcd4aa63203cef781fb (diff) | |
| download | emacs-2a0213a6d0a9e36a388994445837e051d0bbe5f9.tar.gz emacs-2a0213a6d0a9e36a388994445837e051d0bbe5f9.zip | |
Optimize pure C strings initialization.
* lisp.h (make_pure_string): Fix prototype.
(build_pure_c_string): New function, defined as static inline. This
provides a better opportunity to optimize away calls to strlen when
the function is called with compile-time constant argument.
* alloc.c (make_pure_c_string): Fix comment. Change to add nchars
argument, adjust users accordingly. Use build_pure_c_string where
appropriate.
* buffer.c, coding.c, data.c, dbusbind.c, fileio.c, fontset.c, frame.c,
* keyboard.c, keymap.c, lread.c, search.c, syntax.c, w32fns.c, xdisp.c,
* xfaces.c, xfns.c, xterm.c: Use build_pure_c_string where appropriate.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 14 | ||||
| -rw-r--r-- | src/alloc.c | 9 | ||||
| -rw-r--r-- | src/buffer.c | 10 | ||||
| -rw-r--r-- | src/coding.c | 16 | ||||
| -rw-r--r-- | src/data.c | 6 | ||||
| -rw-r--r-- | src/dbusbind.c | 4 | ||||
| -rw-r--r-- | src/fileio.c | 6 | ||||
| -rw-r--r-- | src/fontset.c | 4 | ||||
| -rw-r--r-- | src/frame.c | 2 | ||||
| -rw-r--r-- | src/keyboard.c | 2 | ||||
| -rw-r--r-- | src/keymap.c | 10 | ||||
| -rw-r--r-- | src/lisp.h | 10 | ||||
| -rw-r--r-- | src/lread.c | 10 | ||||
| -rw-r--r-- | src/search.c | 4 | ||||
| -rw-r--r-- | src/syntax.c | 2 | ||||
| -rw-r--r-- | src/w32fns.c | 2 | ||||
| -rw-r--r-- | src/xdisp.c | 8 | ||||
| -rw-r--r-- | src/xfaces.c | 2 | ||||
| -rw-r--r-- | src/xfns.c | 2 | ||||
| -rw-r--r-- | src/xterm.c | 2 |
20 files changed, 73 insertions, 52 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5815c83ae1e..b0f000cadd0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,19 @@ | |||
| 1 | 2012-07-10 Dmitry Antipov <dmantipov@yandex.ru> | 1 | 2012-07-10 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 2 | ||
| 3 | Optimize pure C strings initialization. | ||
| 4 | * lisp.h (make_pure_string): Fix prototype. | ||
| 5 | (build_pure_c_string): New function, defined as static inline. This | ||
| 6 | provides a better opportunity to optimize away calls to strlen when | ||
| 7 | the function is called with compile-time constant argument. | ||
| 8 | * alloc.c (make_pure_c_string): Fix comment. Change to add nchars | ||
| 9 | argument, adjust users accordingly. Use build_pure_c_string where | ||
| 10 | appropriate. | ||
| 11 | * buffer.c, coding.c, data.c, dbusbind.c, fileio.c, fontset.c, frame.c, | ||
| 12 | * keyboard.c, keymap.c, lread.c, search.c, syntax.c, w32fns.c, xdisp.c, | ||
| 13 | * xfaces.c, xfns.c, xterm.c: Use build_pure_c_string where appropriate. | ||
| 14 | |||
| 15 | 2012-07-10 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 16 | |||
| 3 | Avoid calls to strlen in miscellaneous functions. | 17 | Avoid calls to strlen in miscellaneous functions. |
| 4 | * buffer.c (init_buffer): Use precalculated len, adjust if needed. | 18 | * buffer.c (init_buffer): Use precalculated len, adjust if needed. |
| 5 | * font.c (Ffont_xlfd_name): Likewise. Change to call make_string. | 19 | * font.c (Ffont_xlfd_name): Likewise. Change to call make_string. |
diff --git a/src/alloc.c b/src/alloc.c index a5c2e20d0c9..52d683a1b67 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -5212,15 +5212,14 @@ make_pure_string (const char *data, | |||
| 5212 | return string; | 5212 | return string; |
| 5213 | } | 5213 | } |
| 5214 | 5214 | ||
| 5215 | /* Return a string a string allocated in pure space. Do not allocate | 5215 | /* Return a string allocated in pure space. Do not |
| 5216 | the string data, just point to DATA. */ | 5216 | allocate the string data, just point to DATA. */ |
| 5217 | 5217 | ||
| 5218 | Lisp_Object | 5218 | Lisp_Object |
| 5219 | make_pure_c_string (const char *data) | 5219 | make_pure_c_string (const char *data, ptrdiff_t nchars) |
| 5220 | { | 5220 | { |
| 5221 | Lisp_Object string; | 5221 | Lisp_Object string; |
| 5222 | struct Lisp_String *s; | 5222 | struct Lisp_String *s; |
| 5223 | ptrdiff_t nchars = strlen (data); | ||
| 5224 | 5223 | ||
| 5225 | s = (struct Lisp_String *) pure_alloc (sizeof *s, Lisp_String); | 5224 | s = (struct Lisp_String *) pure_alloc (sizeof *s, Lisp_String); |
| 5226 | s->size = nchars; | 5225 | s->size = nchars; |
| @@ -6842,7 +6841,7 @@ do hash-consing of the objects allocated to pure space. */); | |||
| 6842 | not be able to allocate the memory to hold it. */ | 6841 | not be able to allocate the memory to hold it. */ |
| 6843 | Vmemory_signal_data | 6842 | Vmemory_signal_data |
| 6844 | = pure_cons (Qerror, | 6843 | = pure_cons (Qerror, |
| 6845 | pure_cons (make_pure_c_string ("Memory exhausted--use M-x save-some-buffers then exit and restart Emacs"), Qnil)); | 6844 | pure_cons (build_pure_c_string ("Memory exhausted--use M-x save-some-buffers then exit and restart Emacs"), Qnil)); |
| 6846 | 6845 | ||
| 6847 | DEFVAR_LISP ("memory-full", Vmemory_full, | 6846 | DEFVAR_LISP ("memory-full", Vmemory_full, |
| 6848 | doc: /* Non-nil means Emacs cannot get much more Lisp memory. */); | 6847 | doc: /* Non-nil means Emacs cannot get much more Lisp memory. */); |
diff --git a/src/buffer.c b/src/buffer.c index 4999639128d..f06a2a5ea0c 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -4898,7 +4898,7 @@ init_buffer_once (void) | |||
| 4898 | /* Must do these before making the first buffer! */ | 4898 | /* Must do these before making the first buffer! */ |
| 4899 | 4899 | ||
| 4900 | /* real setup is done in bindings.el */ | 4900 | /* real setup is done in bindings.el */ |
| 4901 | BVAR (&buffer_defaults, mode_line_format) = make_pure_c_string ("%-"); | 4901 | BVAR (&buffer_defaults, mode_line_format) = build_pure_c_string ("%-"); |
| 4902 | BVAR (&buffer_defaults, header_line_format) = Qnil; | 4902 | BVAR (&buffer_defaults, header_line_format) = Qnil; |
| 4903 | BVAR (&buffer_defaults, abbrev_mode) = Qnil; | 4903 | BVAR (&buffer_defaults, abbrev_mode) = Qnil; |
| 4904 | BVAR (&buffer_defaults, overwrite_mode) = Qnil; | 4904 | BVAR (&buffer_defaults, overwrite_mode) = Qnil; |
| @@ -5028,7 +5028,7 @@ init_buffer_once (void) | |||
| 5028 | current_buffer = 0; | 5028 | current_buffer = 0; |
| 5029 | all_buffers = 0; | 5029 | all_buffers = 0; |
| 5030 | 5030 | ||
| 5031 | QSFundamental = make_pure_c_string ("Fundamental"); | 5031 | QSFundamental = build_pure_c_string ("Fundamental"); |
| 5032 | 5032 | ||
| 5033 | Qfundamental_mode = intern_c_string ("fundamental-mode"); | 5033 | Qfundamental_mode = intern_c_string ("fundamental-mode"); |
| 5034 | BVAR (&buffer_defaults, major_mode) = Qfundamental_mode; | 5034 | BVAR (&buffer_defaults, major_mode) = Qfundamental_mode; |
| @@ -5043,10 +5043,10 @@ init_buffer_once (void) | |||
| 5043 | Fput (Qkill_buffer_hook, Qpermanent_local, Qt); | 5043 | Fput (Qkill_buffer_hook, Qpermanent_local, Qt); |
| 5044 | 5044 | ||
| 5045 | /* super-magic invisible buffer */ | 5045 | /* super-magic invisible buffer */ |
| 5046 | Vprin1_to_string_buffer = Fget_buffer_create (make_pure_c_string (" prin1")); | 5046 | Vprin1_to_string_buffer = Fget_buffer_create (build_pure_c_string (" prin1")); |
| 5047 | Vbuffer_alist = Qnil; | 5047 | Vbuffer_alist = Qnil; |
| 5048 | 5048 | ||
| 5049 | Fset_buffer (Fget_buffer_create (make_pure_c_string ("*scratch*"))); | 5049 | Fset_buffer (Fget_buffer_create (build_pure_c_string ("*scratch*"))); |
| 5050 | 5050 | ||
| 5051 | inhibit_modification_hooks = 0; | 5051 | inhibit_modification_hooks = 0; |
| 5052 | } | 5052 | } |
| @@ -5201,7 +5201,7 @@ syms_of_buffer (void) | |||
| 5201 | Fput (Qprotected_field, Qerror_conditions, | 5201 | Fput (Qprotected_field, Qerror_conditions, |
| 5202 | pure_cons (Qprotected_field, pure_cons (Qerror, Qnil))); | 5202 | pure_cons (Qprotected_field, pure_cons (Qerror, Qnil))); |
| 5203 | Fput (Qprotected_field, Qerror_message, | 5203 | Fput (Qprotected_field, Qerror_message, |
| 5204 | make_pure_c_string ("Attempt to modify a protected field")); | 5204 | build_pure_c_string ("Attempt to modify a protected field")); |
| 5205 | 5205 | ||
| 5206 | DEFVAR_BUFFER_DEFAULTS ("default-mode-line-format", | 5206 | DEFVAR_BUFFER_DEFAULTS ("default-mode-line-format", |
| 5207 | mode_line_format, | 5207 | mode_line_format, |
diff --git a/src/coding.c b/src/coding.c index 4b2a9740121..8210cacc4d8 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -10350,7 +10350,7 @@ syms_of_coding (void) | |||
| 10350 | Vcode_conversion_reused_workbuf = Qnil; | 10350 | Vcode_conversion_reused_workbuf = Qnil; |
| 10351 | 10351 | ||
| 10352 | staticpro (&Vcode_conversion_workbuf_name); | 10352 | staticpro (&Vcode_conversion_workbuf_name); |
| 10353 | Vcode_conversion_workbuf_name = make_pure_c_string (" *code-conversion-work*"); | 10353 | Vcode_conversion_workbuf_name = build_pure_c_string (" *code-conversion-work*"); |
| 10354 | 10354 | ||
| 10355 | reused_workbuf_in_use = 0; | 10355 | reused_workbuf_in_use = 0; |
| 10356 | 10356 | ||
| @@ -10413,7 +10413,7 @@ syms_of_coding (void) | |||
| 10413 | Fput (Qcoding_system_error, Qerror_conditions, | 10413 | Fput (Qcoding_system_error, Qerror_conditions, |
| 10414 | pure_cons (Qcoding_system_error, pure_cons (Qerror, Qnil))); | 10414 | pure_cons (Qcoding_system_error, pure_cons (Qerror, Qnil))); |
| 10415 | Fput (Qcoding_system_error, Qerror_message, | 10415 | Fput (Qcoding_system_error, Qerror_message, |
| 10416 | make_pure_c_string ("Invalid coding system")); | 10416 | build_pure_c_string ("Invalid coding system")); |
| 10417 | 10417 | ||
| 10418 | /* Intern this now in case it isn't already done. | 10418 | /* Intern this now in case it isn't already done. |
| 10419 | Setting this variable twice is harmless. | 10419 | Setting this variable twice is harmless. |
| @@ -10686,22 +10686,22 @@ Also used for decoding keyboard input on X Window system. */); | |||
| 10686 | DEFVAR_LISP ("eol-mnemonic-unix", eol_mnemonic_unix, | 10686 | DEFVAR_LISP ("eol-mnemonic-unix", eol_mnemonic_unix, |
| 10687 | doc: /* | 10687 | doc: /* |
| 10688 | *String displayed in mode line for UNIX-like (LF) end-of-line format. */); | 10688 | *String displayed in mode line for UNIX-like (LF) end-of-line format. */); |
| 10689 | eol_mnemonic_unix = make_pure_c_string (":"); | 10689 | eol_mnemonic_unix = build_pure_c_string (":"); |
| 10690 | 10690 | ||
| 10691 | DEFVAR_LISP ("eol-mnemonic-dos", eol_mnemonic_dos, | 10691 | DEFVAR_LISP ("eol-mnemonic-dos", eol_mnemonic_dos, |
| 10692 | doc: /* | 10692 | doc: /* |
| 10693 | *String displayed in mode line for DOS-like (CRLF) end-of-line format. */); | 10693 | *String displayed in mode line for DOS-like (CRLF) end-of-line format. */); |
| 10694 | eol_mnemonic_dos = make_pure_c_string ("\\"); | 10694 | eol_mnemonic_dos = build_pure_c_string ("\\"); |
| 10695 | 10695 | ||
| 10696 | DEFVAR_LISP ("eol-mnemonic-mac", eol_mnemonic_mac, | 10696 | DEFVAR_LISP ("eol-mnemonic-mac", eol_mnemonic_mac, |
| 10697 | doc: /* | 10697 | doc: /* |
| 10698 | *String displayed in mode line for MAC-like (CR) end-of-line format. */); | 10698 | *String displayed in mode line for MAC-like (CR) end-of-line format. */); |
| 10699 | eol_mnemonic_mac = make_pure_c_string ("/"); | 10699 | eol_mnemonic_mac = build_pure_c_string ("/"); |
| 10700 | 10700 | ||
| 10701 | DEFVAR_LISP ("eol-mnemonic-undecided", eol_mnemonic_undecided, | 10701 | DEFVAR_LISP ("eol-mnemonic-undecided", eol_mnemonic_undecided, |
| 10702 | doc: /* | 10702 | doc: /* |
| 10703 | *String displayed in mode line when end-of-line format is not yet determined. */); | 10703 | *String displayed in mode line when end-of-line format is not yet determined. */); |
| 10704 | eol_mnemonic_undecided = make_pure_c_string (":"); | 10704 | eol_mnemonic_undecided = build_pure_c_string (":"); |
| 10705 | 10705 | ||
| 10706 | DEFVAR_LISP ("enable-character-translation", Venable_character_translation, | 10706 | DEFVAR_LISP ("enable-character-translation", Venable_character_translation, |
| 10707 | doc: /* | 10707 | doc: /* |
| @@ -10839,7 +10839,7 @@ internal character representation. */); | |||
| 10839 | plist[10] = intern_c_string (":for-unibyte"); | 10839 | plist[10] = intern_c_string (":for-unibyte"); |
| 10840 | plist[11] = args[coding_arg_for_unibyte] = Qt; | 10840 | plist[11] = args[coding_arg_for_unibyte] = Qt; |
| 10841 | plist[12] = intern_c_string (":docstring"); | 10841 | plist[12] = intern_c_string (":docstring"); |
| 10842 | plist[13] = make_pure_c_string ("Do no conversion.\n\ | 10842 | plist[13] = build_pure_c_string ("Do no conversion.\n\ |
| 10843 | \n\ | 10843 | \n\ |
| 10844 | When you visit a file with this coding, the file is read into a\n\ | 10844 | When you visit a file with this coding, the file is read into a\n\ |
| 10845 | unibyte buffer as is, thus each byte of a file is treated as a\n\ | 10845 | unibyte buffer as is, thus each byte of a file is treated as a\n\ |
| @@ -10857,7 +10857,7 @@ character."); | |||
| 10857 | plist[8] = intern_c_string (":charset-list"); | 10857 | plist[8] = intern_c_string (":charset-list"); |
| 10858 | plist[9] = args[coding_arg_charset_list] = Fcons (Qascii, Qnil); | 10858 | plist[9] = args[coding_arg_charset_list] = Fcons (Qascii, Qnil); |
| 10859 | plist[11] = args[coding_arg_for_unibyte] = Qnil; | 10859 | plist[11] = args[coding_arg_for_unibyte] = Qnil; |
| 10860 | plist[13] = make_pure_c_string ("No conversion on encoding, automatic conversion on decoding."); | 10860 | plist[13] = build_pure_c_string ("No conversion on encoding, automatic conversion on decoding."); |
| 10861 | plist[15] = args[coding_arg_eol_type] = Qnil; | 10861 | plist[15] = args[coding_arg_eol_type] = Qnil; |
| 10862 | args[coding_arg_plist] = Flist (16, plist); | 10862 | args[coding_arg_plist] = Flist (16, plist); |
| 10863 | Fdefine_coding_system_internal (coding_arg_max, args); | 10863 | Fdefine_coding_system_internal (coding_arg_max, args); |
diff --git a/src/data.c b/src/data.c index faa87d0013f..4b342c0f521 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -3011,11 +3011,11 @@ syms_of_data (void) | |||
| 3011 | Fput (Qerror, Qerror_conditions, | 3011 | Fput (Qerror, Qerror_conditions, |
| 3012 | error_tail); | 3012 | error_tail); |
| 3013 | Fput (Qerror, Qerror_message, | 3013 | Fput (Qerror, Qerror_message, |
| 3014 | make_pure_c_string ("error")); | 3014 | build_pure_c_string ("error")); |
| 3015 | 3015 | ||
| 3016 | #define PUT_ERROR(sym, tail, msg) \ | 3016 | #define PUT_ERROR(sym, tail, msg) \ |
| 3017 | Fput (sym, Qerror_conditions, pure_cons (sym, tail)); \ | 3017 | Fput (sym, Qerror_conditions, pure_cons (sym, tail)); \ |
| 3018 | Fput (sym, Qerror_message, make_pure_c_string (msg)) | 3018 | Fput (sym, Qerror_message, build_pure_c_string (msg)) |
| 3019 | 3019 | ||
| 3020 | PUT_ERROR (Qquit, Qnil, "Quit"); | 3020 | PUT_ERROR (Qquit, Qnil, "Quit"); |
| 3021 | 3021 | ||
| @@ -3042,7 +3042,7 @@ syms_of_data (void) | |||
| 3042 | 3042 | ||
| 3043 | arith_tail = pure_cons (Qarith_error, error_tail); | 3043 | arith_tail = pure_cons (Qarith_error, error_tail); |
| 3044 | Fput (Qarith_error, Qerror_conditions, arith_tail); | 3044 | Fput (Qarith_error, Qerror_conditions, arith_tail); |
| 3045 | Fput (Qarith_error, Qerror_message, make_pure_c_string ("Arithmetic error")); | 3045 | Fput (Qarith_error, Qerror_message, build_pure_c_string ("Arithmetic error")); |
| 3046 | 3046 | ||
| 3047 | PUT_ERROR (Qbeginning_of_buffer, error_tail, "Beginning of buffer"); | 3047 | PUT_ERROR (Qbeginning_of_buffer, error_tail, "Beginning of buffer"); |
| 3048 | PUT_ERROR (Qend_of_buffer, error_tail, "End of buffer"); | 3048 | PUT_ERROR (Qend_of_buffer, error_tail, "End of buffer"); |
diff --git a/src/dbusbind.c b/src/dbusbind.c index 203a25c151a..86013d92c07 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c | |||
| @@ -1712,7 +1712,7 @@ syms_of_dbusbind (void) | |||
| 1712 | Fput (Qdbus_error, Qerror_conditions, | 1712 | Fput (Qdbus_error, Qerror_conditions, |
| 1713 | list2 (Qdbus_error, Qerror)); | 1713 | list2 (Qdbus_error, Qerror)); |
| 1714 | Fput (Qdbus_error, Qerror_message, | 1714 | Fput (Qdbus_error, Qerror_message, |
| 1715 | make_pure_c_string ("D-Bus error")); | 1715 | build_pure_c_string ("D-Bus error")); |
| 1716 | 1716 | ||
| 1717 | DEFSYM (QCdbus_system_bus, ":system"); | 1717 | DEFSYM (QCdbus_system_bus, ":system"); |
| 1718 | DEFSYM (QCdbus_session_bus, ":session"); | 1718 | DEFSYM (QCdbus_session_bus, ":session"); |
| @@ -1744,7 +1744,7 @@ syms_of_dbusbind (void) | |||
| 1744 | Vdbus_compiled_version, | 1744 | Vdbus_compiled_version, |
| 1745 | doc: /* The version of D-Bus Emacs is compiled against. */); | 1745 | doc: /* The version of D-Bus Emacs is compiled against. */); |
| 1746 | #ifdef DBUS_VERSION_STRING | 1746 | #ifdef DBUS_VERSION_STRING |
| 1747 | Vdbus_compiled_version = make_pure_c_string (DBUS_VERSION_STRING); | 1747 | Vdbus_compiled_version = build_pure_c_string (DBUS_VERSION_STRING); |
| 1748 | #else | 1748 | #else |
| 1749 | Vdbus_compiled_version = Qnil; | 1749 | Vdbus_compiled_version = Qnil; |
| 1750 | #endif | 1750 | #endif |
diff --git a/src/fileio.c b/src/fileio.c index 532ab6097e5..5d4ee1bde08 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -5647,17 +5647,17 @@ of file names regardless of the current language environment. */); | |||
| 5647 | Fput (Qfile_error, Qerror_conditions, | 5647 | Fput (Qfile_error, Qerror_conditions, |
| 5648 | Fpurecopy (list2 (Qfile_error, Qerror))); | 5648 | Fpurecopy (list2 (Qfile_error, Qerror))); |
| 5649 | Fput (Qfile_error, Qerror_message, | 5649 | Fput (Qfile_error, Qerror_message, |
| 5650 | make_pure_c_string ("File error")); | 5650 | build_pure_c_string ("File error")); |
| 5651 | 5651 | ||
| 5652 | Fput (Qfile_already_exists, Qerror_conditions, | 5652 | Fput (Qfile_already_exists, Qerror_conditions, |
| 5653 | Fpurecopy (list3 (Qfile_already_exists, Qfile_error, Qerror))); | 5653 | Fpurecopy (list3 (Qfile_already_exists, Qfile_error, Qerror))); |
| 5654 | Fput (Qfile_already_exists, Qerror_message, | 5654 | Fput (Qfile_already_exists, Qerror_message, |
| 5655 | make_pure_c_string ("File already exists")); | 5655 | build_pure_c_string ("File already exists")); |
| 5656 | 5656 | ||
| 5657 | Fput (Qfile_date_error, Qerror_conditions, | 5657 | Fput (Qfile_date_error, Qerror_conditions, |
| 5658 | Fpurecopy (list3 (Qfile_date_error, Qfile_error, Qerror))); | 5658 | Fpurecopy (list3 (Qfile_date_error, Qfile_error, Qerror))); |
| 5659 | Fput (Qfile_date_error, Qerror_message, | 5659 | Fput (Qfile_date_error, Qerror_message, |
| 5660 | make_pure_c_string ("Cannot set file date")); | 5660 | build_pure_c_string ("Cannot set file date")); |
| 5661 | 5661 | ||
| 5662 | DEFVAR_LISP ("file-name-handler-alist", Vfile_name_handler_alist, | 5662 | DEFVAR_LISP ("file-name-handler-alist", Vfile_name_handler_alist, |
| 5663 | doc: /* Alist of elements (REGEXP . HANDLER) for file names handled specially. | 5663 | doc: /* Alist of elements (REGEXP . HANDLER) for file names handled specially. |
diff --git a/src/fontset.c b/src/fontset.c index cfaa24124f1..bd5956d2bee 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -2164,7 +2164,7 @@ syms_of_fontset (void) | |||
| 2164 | staticpro (&Vdefault_fontset); | 2164 | staticpro (&Vdefault_fontset); |
| 2165 | FONTSET_ID (Vdefault_fontset) = make_number (0); | 2165 | FONTSET_ID (Vdefault_fontset) = make_number (0); |
| 2166 | FONTSET_NAME (Vdefault_fontset) | 2166 | FONTSET_NAME (Vdefault_fontset) |
| 2167 | = make_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default"); | 2167 | = build_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default"); |
| 2168 | ASET (Vfontset_table, 0, Vdefault_fontset); | 2168 | ASET (Vfontset_table, 0, Vdefault_fontset); |
| 2169 | next_fontset_id = 1; | 2169 | next_fontset_id = 1; |
| 2170 | 2170 | ||
| @@ -2210,7 +2210,7 @@ alternate fontnames (if any) are tried instead. */); | |||
| 2210 | DEFVAR_LISP ("fontset-alias-alist", Vfontset_alias_alist, | 2210 | DEFVAR_LISP ("fontset-alias-alist", Vfontset_alias_alist, |
| 2211 | doc: /* Alist of fontset names vs the aliases. */); | 2211 | doc: /* Alist of fontset names vs the aliases. */); |
| 2212 | Vfontset_alias_alist = Fcons (Fcons (FONTSET_NAME (Vdefault_fontset), | 2212 | Vfontset_alias_alist = Fcons (Fcons (FONTSET_NAME (Vdefault_fontset), |
| 2213 | make_pure_c_string ("fontset-default")), | 2213 | build_pure_c_string ("fontset-default")), |
| 2214 | Qnil); | 2214 | Qnil); |
| 2215 | 2215 | ||
| 2216 | DEFVAR_LISP ("vertical-centering-font-regexp", | 2216 | DEFVAR_LISP ("vertical-centering-font-regexp", |
diff --git a/src/frame.c b/src/frame.c index be5631da773..61baa25be3d 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -477,7 +477,7 @@ make_initial_frame (void) | |||
| 477 | Vframe_list = Fcons (frame, Vframe_list); | 477 | Vframe_list = Fcons (frame, Vframe_list); |
| 478 | 478 | ||
| 479 | tty_frame_count = 1; | 479 | tty_frame_count = 1; |
| 480 | f->name = make_pure_c_string ("F1"); | 480 | f->name = build_pure_c_string ("F1"); |
| 481 | 481 | ||
| 482 | f->visible = 1; | 482 | f->visible = 1; |
| 483 | f->async_visible = 1; | 483 | f->async_visible = 1; |
diff --git a/src/keyboard.c b/src/keyboard.c index 93f073986f2..71c8d869ece 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -11441,7 +11441,7 @@ syms_of_keyboard (void) | |||
| 11441 | pending_funcalls = Qnil; | 11441 | pending_funcalls = Qnil; |
| 11442 | staticpro (&pending_funcalls); | 11442 | staticpro (&pending_funcalls); |
| 11443 | 11443 | ||
| 11444 | Vlispy_mouse_stem = make_pure_c_string ("mouse"); | 11444 | Vlispy_mouse_stem = build_pure_c_string ("mouse"); |
| 11445 | staticpro (&Vlispy_mouse_stem); | 11445 | staticpro (&Vlispy_mouse_stem); |
| 11446 | 11446 | ||
| 11447 | /* Tool-bars. */ | 11447 | /* Tool-bars. */ |
diff --git a/src/keymap.c b/src/keymap.c index 234740721ae..cfc1e2e495c 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -3705,11 +3705,11 @@ syms_of_keymap (void) | |||
| 3705 | Ffset (intern_c_string ("Control-X-prefix"), control_x_map); | 3705 | Ffset (intern_c_string ("Control-X-prefix"), control_x_map); |
| 3706 | 3706 | ||
| 3707 | exclude_keys | 3707 | exclude_keys |
| 3708 | = pure_cons (pure_cons (make_pure_c_string ("DEL"), make_pure_c_string ("\\d")), | 3708 | = pure_cons (pure_cons (build_pure_c_string ("DEL"), build_pure_c_string ("\\d")), |
| 3709 | pure_cons (pure_cons (make_pure_c_string ("TAB"), make_pure_c_string ("\\t")), | 3709 | pure_cons (pure_cons (build_pure_c_string ("TAB"), build_pure_c_string ("\\t")), |
| 3710 | pure_cons (pure_cons (make_pure_c_string ("RET"), make_pure_c_string ("\\r")), | 3710 | pure_cons (pure_cons (build_pure_c_string ("RET"), build_pure_c_string ("\\r")), |
| 3711 | pure_cons (pure_cons (make_pure_c_string ("ESC"), make_pure_c_string ("\\e")), | 3711 | pure_cons (pure_cons (build_pure_c_string ("ESC"), build_pure_c_string ("\\e")), |
| 3712 | pure_cons (pure_cons (make_pure_c_string ("SPC"), make_pure_c_string (" ")), | 3712 | pure_cons (pure_cons (build_pure_c_string ("SPC"), build_pure_c_string (" ")), |
| 3713 | Qnil))))); | 3713 | Qnil))))); |
| 3714 | staticpro (&exclude_keys); | 3714 | staticpro (&exclude_keys); |
| 3715 | 3715 | ||
diff --git a/src/lisp.h b/src/lisp.h index ba27d86fc85..b4499b0eaaa 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -2626,7 +2626,15 @@ extern Lisp_Object make_string_from_bytes (const char *, ptrdiff_t, ptrdiff_t); | |||
| 2626 | extern Lisp_Object make_specified_string (const char *, | 2626 | extern Lisp_Object make_specified_string (const char *, |
| 2627 | ptrdiff_t, ptrdiff_t, int); | 2627 | ptrdiff_t, ptrdiff_t, int); |
| 2628 | extern Lisp_Object make_pure_string (const char *, ptrdiff_t, ptrdiff_t, int); | 2628 | extern Lisp_Object make_pure_string (const char *, ptrdiff_t, ptrdiff_t, int); |
| 2629 | extern Lisp_Object make_pure_c_string (const char *data); | 2629 | extern Lisp_Object make_pure_c_string (const char *, ptrdiff_t); |
| 2630 | |||
| 2631 | /* Make a string allocated in pure space, use STR as string data. */ | ||
| 2632 | |||
| 2633 | static inline Lisp_Object | ||
| 2634 | build_pure_c_string (const char *str) | ||
| 2635 | { | ||
| 2636 | return make_pure_c_string (str, strlen (str)); | ||
| 2637 | } | ||
| 2630 | 2638 | ||
| 2631 | /* Make a string from the data at STR, treating it as multibyte if the | 2639 | /* Make a string from the data at STR, treating it as multibyte if the |
| 2632 | data warrants. */ | 2640 | data warrants. */ |
diff --git a/src/lread.c b/src/lread.c index 900a25372d8..bd85e44093e 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -3700,7 +3700,7 @@ intern_c_string (const char *str) | |||
| 3700 | with the extra copy. */ | 3700 | with the extra copy. */ |
| 3701 | abort (); | 3701 | abort (); |
| 3702 | 3702 | ||
| 3703 | return Fintern (make_pure_c_string (str), obarray); | 3703 | return Fintern (make_pure_c_string (str, len), obarray); |
| 3704 | } | 3704 | } |
| 3705 | 3705 | ||
| 3706 | DEFUN ("intern", Fintern, Sintern, 1, 2, 0, | 3706 | DEFUN ("intern", Fintern, Sintern, 1, 2, 0, |
| @@ -3941,7 +3941,7 @@ init_obarray (void) | |||
| 3941 | initial_obarray = Vobarray; | 3941 | initial_obarray = Vobarray; |
| 3942 | staticpro (&initial_obarray); | 3942 | staticpro (&initial_obarray); |
| 3943 | 3943 | ||
| 3944 | Qunbound = Fmake_symbol (make_pure_c_string ("unbound")); | 3944 | Qunbound = Fmake_symbol (build_pure_c_string ("unbound")); |
| 3945 | /* Set temporary dummy values to Qnil and Vpurify_flag to satisfy the | 3945 | /* Set temporary dummy values to Qnil and Vpurify_flag to satisfy the |
| 3946 | NILP (Vpurify_flag) check in intern_c_string. */ | 3946 | NILP (Vpurify_flag) check in intern_c_string. */ |
| 3947 | Qnil = make_number (-1); Vpurify_flag = make_number (1); | 3947 | Qnil = make_number (-1); Vpurify_flag = make_number (1); |
| @@ -4441,8 +4441,8 @@ otherwise to default specified by file `epaths.h' when Emacs was built. */); | |||
| 4441 | This list should not include the empty string. | 4441 | This list should not include the empty string. |
| 4442 | `load' and related functions try to append these suffixes, in order, | 4442 | `load' and related functions try to append these suffixes, in order, |
| 4443 | to the specified file name if a Lisp suffix is allowed or required. */); | 4443 | to the specified file name if a Lisp suffix is allowed or required. */); |
| 4444 | Vload_suffixes = Fcons (make_pure_c_string (".elc"), | 4444 | Vload_suffixes = Fcons (build_pure_c_string (".elc"), |
| 4445 | Fcons (make_pure_c_string (".el"), Qnil)); | 4445 | Fcons (build_pure_c_string (".el"), Qnil)); |
| 4446 | DEFVAR_LISP ("load-file-rep-suffixes", Vload_file_rep_suffixes, | 4446 | DEFVAR_LISP ("load-file-rep-suffixes", Vload_file_rep_suffixes, |
| 4447 | doc: /* List of suffixes that indicate representations of \ | 4447 | doc: /* List of suffixes that indicate representations of \ |
| 4448 | the same file. | 4448 | the same file. |
| @@ -4575,7 +4575,7 @@ from the file, and matches them against this regular expression. | |||
| 4575 | When the regular expression matches, the file is considered to be safe | 4575 | When the regular expression matches, the file is considered to be safe |
| 4576 | to load. See also `load-dangerous-libraries'. */); | 4576 | to load. See also `load-dangerous-libraries'. */); |
| 4577 | Vbytecomp_version_regexp | 4577 | Vbytecomp_version_regexp |
| 4578 | = make_pure_c_string ("^;;;.\\(in Emacs version\\|bytecomp version FSF\\)"); | 4578 | = build_pure_c_string ("^;;;.\\(in Emacs version\\|bytecomp version FSF\\)"); |
| 4579 | 4579 | ||
| 4580 | Qlexical_binding = intern ("lexical-binding"); | 4580 | Qlexical_binding = intern ("lexical-binding"); |
| 4581 | staticpro (&Qlexical_binding); | 4581 | staticpro (&Qlexical_binding); |
diff --git a/src/search.c b/src/search.c index 9004dc78271..de95f5a30f4 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -3056,12 +3056,12 @@ syms_of_search (void) | |||
| 3056 | Fput (Qsearch_failed, Qerror_conditions, | 3056 | Fput (Qsearch_failed, Qerror_conditions, |
| 3057 | pure_cons (Qsearch_failed, pure_cons (Qerror, Qnil))); | 3057 | pure_cons (Qsearch_failed, pure_cons (Qerror, Qnil))); |
| 3058 | Fput (Qsearch_failed, Qerror_message, | 3058 | Fput (Qsearch_failed, Qerror_message, |
| 3059 | make_pure_c_string ("Search failed")); | 3059 | build_pure_c_string ("Search failed")); |
| 3060 | 3060 | ||
| 3061 | Fput (Qinvalid_regexp, Qerror_conditions, | 3061 | Fput (Qinvalid_regexp, Qerror_conditions, |
| 3062 | pure_cons (Qinvalid_regexp, pure_cons (Qerror, Qnil))); | 3062 | pure_cons (Qinvalid_regexp, pure_cons (Qerror, Qnil))); |
| 3063 | Fput (Qinvalid_regexp, Qerror_message, | 3063 | Fput (Qinvalid_regexp, Qerror_message, |
| 3064 | make_pure_c_string ("Invalid regexp")); | 3064 | build_pure_c_string ("Invalid regexp")); |
| 3065 | 3065 | ||
| 3066 | last_thing_searched = Qnil; | 3066 | last_thing_searched = Qnil; |
| 3067 | staticpro (&last_thing_searched); | 3067 | staticpro (&last_thing_searched); |
diff --git a/src/syntax.c b/src/syntax.c index de1ab2a7516..69c2789ed39 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -3475,7 +3475,7 @@ syms_of_syntax (void) | |||
| 3475 | Fput (Qscan_error, Qerror_conditions, | 3475 | Fput (Qscan_error, Qerror_conditions, |
| 3476 | pure_cons (Qscan_error, pure_cons (Qerror, Qnil))); | 3476 | pure_cons (Qscan_error, pure_cons (Qerror, Qnil))); |
| 3477 | Fput (Qscan_error, Qerror_message, | 3477 | Fput (Qscan_error, Qerror_message, |
| 3478 | make_pure_c_string ("Scan error")); | 3478 | build_pure_c_string ("Scan error")); |
| 3479 | 3479 | ||
| 3480 | DEFVAR_BOOL ("parse-sexp-ignore-comments", parse_sexp_ignore_comments, | 3480 | DEFVAR_BOOL ("parse-sexp-ignore-comments", parse_sexp_ignore_comments, |
| 3481 | doc: /* Non-nil means `forward-sexp', etc., should treat comments as whitespace. */); | 3481 | doc: /* Non-nil means `forward-sexp', etc., should treat comments as whitespace. */); |
diff --git a/src/w32fns.c b/src/w32fns.c index 53d344d11e8..459d4c835f5 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -6798,7 +6798,7 @@ syms_of_w32fns (void) | |||
| 6798 | Fput (Qundefined_color, Qerror_conditions, | 6798 | Fput (Qundefined_color, Qerror_conditions, |
| 6799 | pure_cons (Qundefined_color, pure_cons (Qerror, Qnil))); | 6799 | pure_cons (Qundefined_color, pure_cons (Qerror, Qnil))); |
| 6800 | Fput (Qundefined_color, Qerror_message, | 6800 | Fput (Qundefined_color, Qerror_message, |
| 6801 | make_pure_c_string ("Undefined color")); | 6801 | build_pure_c_string ("Undefined color")); |
| 6802 | 6802 | ||
| 6803 | staticpro (&w32_grabbed_keys); | 6803 | staticpro (&w32_grabbed_keys); |
| 6804 | w32_grabbed_keys = Qnil; | 6804 | w32_grabbed_keys = Qnil; |
diff --git a/src/xdisp.c b/src/xdisp.c index 4b9445d7469..1732e3dfe56 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -28728,7 +28728,7 @@ syms_of_xdisp (void) | |||
| 28728 | staticpro (&echo_area_buffer[0]); | 28728 | staticpro (&echo_area_buffer[0]); |
| 28729 | staticpro (&echo_area_buffer[1]); | 28729 | staticpro (&echo_area_buffer[1]); |
| 28730 | 28730 | ||
| 28731 | Vmessages_buffer_name = make_pure_c_string ("*Messages*"); | 28731 | Vmessages_buffer_name = build_pure_c_string ("*Messages*"); |
| 28732 | staticpro (&Vmessages_buffer_name); | 28732 | staticpro (&Vmessages_buffer_name); |
| 28733 | 28733 | ||
| 28734 | mode_line_proptrans_alist = Qnil; | 28734 | mode_line_proptrans_alist = Qnil; |
| @@ -28809,7 +28809,7 @@ See also `overlay-arrow-string'. */); | |||
| 28809 | DEFVAR_LISP ("overlay-arrow-string", Voverlay_arrow_string, | 28809 | DEFVAR_LISP ("overlay-arrow-string", Voverlay_arrow_string, |
| 28810 | doc: /* String to display as an arrow in non-window frames. | 28810 | doc: /* String to display as an arrow in non-window frames. |
| 28811 | See also `overlay-arrow-position'. */); | 28811 | See also `overlay-arrow-position'. */); |
| 28812 | Voverlay_arrow_string = make_pure_c_string ("=>"); | 28812 | Voverlay_arrow_string = build_pure_c_string ("=>"); |
| 28813 | 28813 | ||
| 28814 | DEFVAR_LISP ("overlay-arrow-variable-list", Voverlay_arrow_variable_list, | 28814 | DEFVAR_LISP ("overlay-arrow-variable-list", Voverlay_arrow_variable_list, |
| 28815 | doc: /* List of variables (symbols) which hold markers for overlay arrows. | 28815 | doc: /* List of variables (symbols) which hold markers for overlay arrows. |
| @@ -28915,10 +28915,10 @@ and is used only on frames for which no explicit name has been set | |||
| 28915 | Vicon_title_format | 28915 | Vicon_title_format |
| 28916 | = Vframe_title_format | 28916 | = Vframe_title_format |
| 28917 | = pure_cons (intern_c_string ("multiple-frames"), | 28917 | = pure_cons (intern_c_string ("multiple-frames"), |
| 28918 | pure_cons (make_pure_c_string ("%b"), | 28918 | pure_cons (build_pure_c_string ("%b"), |
| 28919 | pure_cons (pure_cons (empty_unibyte_string, | 28919 | pure_cons (pure_cons (empty_unibyte_string, |
| 28920 | pure_cons (intern_c_string ("invocation-name"), | 28920 | pure_cons (intern_c_string ("invocation-name"), |
| 28921 | pure_cons (make_pure_c_string ("@"), | 28921 | pure_cons (build_pure_c_string ("@"), |
| 28922 | pure_cons (intern_c_string ("system-name"), | 28922 | pure_cons (intern_c_string ("system-name"), |
| 28923 | Qnil)))), | 28923 | Qnil)))), |
| 28924 | Qnil))); | 28924 | Qnil))); |
diff --git a/src/xfaces.c b/src/xfaces.c index a6b260a2929..e9089017c4e 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -6643,7 +6643,7 @@ that number of fonts when searching for a matching font. */); | |||
| 6643 | This stipple pattern is used on monochrome displays | 6643 | This stipple pattern is used on monochrome displays |
| 6644 | instead of shades of gray for a face background color. | 6644 | instead of shades of gray for a face background color. |
| 6645 | See `set-face-stipple' for possible values for this variable. */); | 6645 | See `set-face-stipple' for possible values for this variable. */); |
| 6646 | Vface_default_stipple = make_pure_c_string ("gray3"); | 6646 | Vface_default_stipple = build_pure_c_string ("gray3"); |
| 6647 | 6647 | ||
| 6648 | DEFVAR_LISP ("tty-defined-color-alist", Vtty_defined_color_alist, | 6648 | DEFVAR_LISP ("tty-defined-color-alist", Vtty_defined_color_alist, |
| 6649 | doc: /* An alist of defined terminal colors and their RGB values. | 6649 | doc: /* An alist of defined terminal colors and their RGB values. |
diff --git a/src/xfns.c b/src/xfns.c index 35f715d89f7..ad3fff85f30 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -5828,7 +5828,7 @@ syms_of_xfns (void) | |||
| 5828 | Fput (Qundefined_color, Qerror_conditions, | 5828 | Fput (Qundefined_color, Qerror_conditions, |
| 5829 | pure_cons (Qundefined_color, pure_cons (Qerror, Qnil))); | 5829 | pure_cons (Qundefined_color, pure_cons (Qerror, Qnil))); |
| 5830 | Fput (Qundefined_color, Qerror_message, | 5830 | Fput (Qundefined_color, Qerror_message, |
| 5831 | make_pure_c_string ("Undefined color")); | 5831 | build_pure_c_string ("Undefined color")); |
| 5832 | 5832 | ||
| 5833 | DEFVAR_LISP ("x-pointer-shape", Vx_pointer_shape, | 5833 | DEFVAR_LISP ("x-pointer-shape", Vx_pointer_shape, |
| 5834 | doc: /* The shape of the pointer when over text. | 5834 | doc: /* The shape of the pointer when over text. |
diff --git a/src/xterm.c b/src/xterm.c index b73290ccd00..3cf6b4c349a 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -10845,7 +10845,7 @@ syms_of_xterm (void) | |||
| 10845 | last_mouse_press_frame = Qnil; | 10845 | last_mouse_press_frame = Qnil; |
| 10846 | 10846 | ||
| 10847 | #ifdef USE_GTK | 10847 | #ifdef USE_GTK |
| 10848 | xg_default_icon_file = make_pure_c_string ("icons/hicolor/scalable/apps/emacs.svg"); | 10848 | xg_default_icon_file = build_pure_c_string ("icons/hicolor/scalable/apps/emacs.svg"); |
| 10849 | staticpro (&xg_default_icon_file); | 10849 | staticpro (&xg_default_icon_file); |
| 10850 | 10850 | ||
| 10851 | DEFSYM (Qx_gtk_map_stock, "x-gtk-map-stock"); | 10851 | DEFSYM (Qx_gtk_map_stock, "x-gtk-map-stock"); |