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/buffer.c | |
| 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/buffer.c')
| -rw-r--r-- | src/buffer.c | 10 |
1 files changed, 5 insertions, 5 deletions
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, |