aboutsummaryrefslogtreecommitdiffstats
path: root/src/intervals.c
diff options
context:
space:
mode:
authorPaul Eggert2015-10-10 00:17:11 -0700
committerPaul Eggert2015-10-10 00:18:39 -0700
commitbb7c182fdaf8553ffdc9162f322177ae2f7fa0c2 (patch)
tree444b1eef3d424cb5b07396a11bc66fe401d0a1dd /src/intervals.c
parent1196e3fca6f9df107c76438b7d00090d19b13570 (diff)
downloademacs-bb7c182fdaf8553ffdc9162f322177ae2f7fa0c2.tar.gz
emacs-bb7c182fdaf8553ffdc9162f322177ae2f7fa0c2.zip
CHECK_IMPURE and PURE_P speedup
* src/intervals.c (create_root_interval): Do CHECK_IMPURE only for strings; not needed for buffers. Prefer ! STRINGP to BUFFERP, for a tad more speed. * src/puresize.h (CHECK_IMPURE, PURE_P): Now inline functions instead of macros. (PURE_P): Don’t use XPNTR; that is now the caller’s responsibility. All callers changed. (CHECK_IMPURE): New argument PTR, to save us the work of running XPNTR. All callers changed.
Diffstat (limited to 'src/intervals.c')
-rw-r--r--src/intervals.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/intervals.c b/src/intervals.c
index 78e0f50f6fe..1c8dd41e6a2 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -91,11 +91,9 @@ create_root_interval (Lisp_Object parent)
91{ 91{
92 INTERVAL new; 92 INTERVAL new;
93 93
94 CHECK_IMPURE (parent);
95
96 new = make_interval (); 94 new = make_interval ();
97 95
98 if (BUFFERP (parent)) 96 if (! STRINGP (parent))
99 { 97 {
100 new->total_length = (BUF_Z (XBUFFER (parent)) 98 new->total_length = (BUF_Z (XBUFFER (parent))
101 - BUF_BEG (XBUFFER (parent))); 99 - BUF_BEG (XBUFFER (parent)));
@@ -103,15 +101,16 @@ create_root_interval (Lisp_Object parent)
103 set_buffer_intervals (XBUFFER (parent), new); 101 set_buffer_intervals (XBUFFER (parent), new);
104 new->position = BEG; 102 new->position = BEG;
105 } 103 }
106 else if (STRINGP (parent)) 104 else
107 { 105 {
106 CHECK_IMPURE (parent, XSTRING (parent));
108 new->total_length = SCHARS (parent); 107 new->total_length = SCHARS (parent);
109 eassert (TOTAL_LENGTH (new) >= 0); 108 eassert (TOTAL_LENGTH (new) >= 0);
110 set_string_intervals (parent, new); 109 set_string_intervals (parent, new);
111 new->position = 0; 110 new->position = 0;
112 } 111 }
113 eassert (LENGTH (new) > 0); 112 eassert (LENGTH (new) > 0);
114 113
115 set_interval_object (new, parent); 114 set_interval_object (new, parent);
116 115
117 return new; 116 return new;