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/data.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/data.c')
| -rw-r--r-- | src/data.c | 6 |
1 files changed, 3 insertions, 3 deletions
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"); |