diff options
| author | Richard M. Stallman | 1994-05-24 21:16:23 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-05-24 21:16:23 +0000 |
| commit | 55b4889367642198d2e7ea44e338bbe191414d97 (patch) | |
| tree | e56040b5d75703f110beec68b5a515165bc0d4bb /src | |
| parent | b5b90d18cc81b8b415027605bc043b8b89caa5e4 (diff) | |
| download | emacs-55b4889367642198d2e7ea44e338bbe191414d97.tar.gz emacs-55b4889367642198d2e7ea44e338bbe191414d97.zip | |
(verify_overlay_modification): GCPRO tail and overlay.
Avoid copying tail twice.
Diffstat (limited to 'src')
| -rw-r--r-- | src/buffer.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/src/buffer.c b/src/buffer.c index 1293b1590e9..8ebfe98388c 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -2134,7 +2134,14 @@ verify_overlay_modification (start, end) | |||
| 2134 | { | 2134 | { |
| 2135 | Lisp_Object prop, overlay, tail; | 2135 | Lisp_Object prop, overlay, tail; |
| 2136 | int insertion = EQ (start, end); | 2136 | int insertion = EQ (start, end); |
| 2137 | int tail_copied; | ||
| 2138 | struct gcpro gcpro1, gcpro2; | ||
| 2139 | |||
| 2140 | overlay = Qnil; | ||
| 2141 | tail = Qnil; | ||
| 2142 | GCPRO2 (overlay, tail); | ||
| 2137 | 2143 | ||
| 2144 | tail_copied = 0; | ||
| 2138 | for (tail = current_buffer->overlays_before; | 2145 | for (tail = current_buffer->overlays_before; |
| 2139 | CONSP (tail); | 2146 | CONSP (tail); |
| 2140 | tail = XCONS (tail)->cdr) | 2147 | tail = XCONS (tail)->cdr) |
| @@ -2156,7 +2163,9 @@ verify_overlay_modification (start, end) | |||
| 2156 | if (!NILP (prop)) | 2163 | if (!NILP (prop)) |
| 2157 | { | 2164 | { |
| 2158 | /* Copy TAIL in case the hook recenters the overlay lists. */ | 2165 | /* Copy TAIL in case the hook recenters the overlay lists. */ |
| 2159 | tail = Fcopy_sequence (tail); | 2166 | if (!tail_copied) |
| 2167 | tail = Fcopy_sequence (tail); | ||
| 2168 | tail_copied = 1; | ||
| 2160 | call_overlay_mod_hooks (prop, overlay, start, end); | 2169 | call_overlay_mod_hooks (prop, overlay, start, end); |
| 2161 | } | 2170 | } |
| 2162 | } | 2171 | } |
| @@ -2165,7 +2174,9 @@ verify_overlay_modification (start, end) | |||
| 2165 | prop = Foverlay_get (overlay, Qinsert_behind_hooks); | 2174 | prop = Foverlay_get (overlay, Qinsert_behind_hooks); |
| 2166 | if (!NILP (prop)) | 2175 | if (!NILP (prop)) |
| 2167 | { | 2176 | { |
| 2168 | tail = Fcopy_sequence (tail); | 2177 | if (!tail_copied) |
| 2178 | tail = Fcopy_sequence (tail); | ||
| 2179 | tail_copied = 1; | ||
| 2169 | call_overlay_mod_hooks (prop, overlay, start, end); | 2180 | call_overlay_mod_hooks (prop, overlay, start, end); |
| 2170 | } | 2181 | } |
| 2171 | } | 2182 | } |
| @@ -2176,12 +2187,15 @@ verify_overlay_modification (start, end) | |||
| 2176 | prop = Foverlay_get (overlay, Qmodification_hooks); | 2187 | prop = Foverlay_get (overlay, Qmodification_hooks); |
| 2177 | if (!NILP (prop)) | 2188 | if (!NILP (prop)) |
| 2178 | { | 2189 | { |
| 2179 | tail = Fcopy_sequence (tail); | 2190 | if (!tail_copied) |
| 2191 | tail = Fcopy_sequence (tail); | ||
| 2192 | tail_copied = 1; | ||
| 2180 | call_overlay_mod_hooks (prop, overlay, start, end); | 2193 | call_overlay_mod_hooks (prop, overlay, start, end); |
| 2181 | } | 2194 | } |
| 2182 | } | 2195 | } |
| 2183 | } | 2196 | } |
| 2184 | 2197 | ||
| 2198 | tail_copied = 0; | ||
| 2185 | for (tail = current_buffer->overlays_after; | 2199 | for (tail = current_buffer->overlays_after; |
| 2186 | CONSP (tail); | 2200 | CONSP (tail); |
| 2187 | tail = XCONS (tail)->cdr) | 2201 | tail = XCONS (tail)->cdr) |
| @@ -2202,7 +2216,9 @@ verify_overlay_modification (start, end) | |||
| 2202 | prop = Foverlay_get (overlay, Qinsert_in_front_hooks); | 2216 | prop = Foverlay_get (overlay, Qinsert_in_front_hooks); |
| 2203 | if (!NILP (prop)) | 2217 | if (!NILP (prop)) |
| 2204 | { | 2218 | { |
| 2205 | tail = Fcopy_sequence (tail); | 2219 | if (!tail_copied) |
| 2220 | tail = Fcopy_sequence (tail); | ||
| 2221 | tail_copied = 1; | ||
| 2206 | call_overlay_mod_hooks (prop, overlay, start, end); | 2222 | call_overlay_mod_hooks (prop, overlay, start, end); |
| 2207 | } | 2223 | } |
| 2208 | } | 2224 | } |
| @@ -2211,7 +2227,9 @@ verify_overlay_modification (start, end) | |||
| 2211 | prop = Foverlay_get (overlay, Qinsert_behind_hooks); | 2227 | prop = Foverlay_get (overlay, Qinsert_behind_hooks); |
| 2212 | if (!NILP (prop)) | 2228 | if (!NILP (prop)) |
| 2213 | { | 2229 | { |
| 2214 | tail = Fcopy_sequence (tail); | 2230 | if (!tail_copied) |
| 2231 | tail = Fcopy_sequence (tail); | ||
| 2232 | tail_copied = 1; | ||
| 2215 | call_overlay_mod_hooks (prop, overlay, start, end); | 2233 | call_overlay_mod_hooks (prop, overlay, start, end); |
| 2216 | } | 2234 | } |
| 2217 | } | 2235 | } |
| @@ -2222,11 +2240,15 @@ verify_overlay_modification (start, end) | |||
| 2222 | prop = Foverlay_get (overlay, Qmodification_hooks); | 2240 | prop = Foverlay_get (overlay, Qmodification_hooks); |
| 2223 | if (!NILP (prop)) | 2241 | if (!NILP (prop)) |
| 2224 | { | 2242 | { |
| 2225 | tail = Fcopy_sequence (tail); | 2243 | if (!tail_copied) |
| 2244 | tail = Fcopy_sequence (tail); | ||
| 2245 | tail_copied = 1; | ||
| 2226 | call_overlay_mod_hooks (prop, overlay, start, end); | 2246 | call_overlay_mod_hooks (prop, overlay, start, end); |
| 2227 | } | 2247 | } |
| 2228 | } | 2248 | } |
| 2229 | } | 2249 | } |
| 2250 | |||
| 2251 | UNGCPRO; | ||
| 2230 | } | 2252 | } |
| 2231 | 2253 | ||
| 2232 | static void | 2254 | static void |