aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKarl Heuer1994-09-27 01:13:35 +0000
committerKarl Heuer1994-09-27 01:13:35 +0000
commit38c0d37cf5913e69aa45726fa85049a11a631ec5 (patch)
treee2ced16dbf46236f7bb6a67eabb46f4613ccf95d /src
parentf2d800a4e8d7ab6bd5a68d6e63afc5402aadeb2f (diff)
downloademacs-38c0d37cf5913e69aa45726fa85049a11a631ec5.tar.gz
emacs-38c0d37cf5913e69aa45726fa85049a11a631ec5.zip
(record_insert, truncate_undo_list, Fprimitive_undo): Use type test macros.
Diffstat (limited to 'src')
-rw-r--r--src/undo.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/undo.c b/src/undo.c
index fef2698c759..abd5adbd30c 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -62,13 +62,13 @@ record_insert (beg, length)
62 62
63 /* If this is following another insertion and consecutive with it 63 /* If this is following another insertion and consecutive with it
64 in the buffer, combine the two. */ 64 in the buffer, combine the two. */
65 if (XTYPE (current_buffer->undo_list) == Lisp_Cons) 65 if (CONSP (current_buffer->undo_list))
66 { 66 {
67 Lisp_Object elt; 67 Lisp_Object elt;
68 elt = XCONS (current_buffer->undo_list)->car; 68 elt = XCONS (current_buffer->undo_list)->car;
69 if (XTYPE (elt) == Lisp_Cons 69 if (CONSP (elt)
70 && XTYPE (XCONS (elt)->car) == Lisp_Int 70 && INTEGERP (XCONS (elt)->car)
71 && XTYPE (XCONS (elt)->cdr) == Lisp_Int 71 && INTEGERP (XCONS (elt)->cdr)
72 && XINT (XCONS (elt)->cdr) == XINT (beg)) 72 && XINT (XCONS (elt)->cdr) == XINT (beg))
73 { 73 {
74 XSETINT (XCONS (elt)->cdr, XINT (beg) + XINT (length)); 74 XSETINT (XCONS (elt)->cdr, XINT (beg) + XINT (length));
@@ -249,8 +249,7 @@ truncate_undo_list (list, minsize, maxsize)
249 Skip, skip, skip the undo, skip, skip, skip the undo, 249 Skip, skip, skip the undo, skip, skip, skip the undo,
250 Skip, skip, skip the undo, skip to the undo bound'ry. 250 Skip, skip, skip the undo, skip to the undo bound'ry.
251 (Get it? "Skip to my Loo?") */ 251 (Get it? "Skip to my Loo?") */
252 if (XTYPE (next) == Lisp_Cons 252 if (CONSP (next) && NILP (XCONS (next)->car))
253 && NILP (XCONS (next)->car))
254 { 253 {
255 /* Add in the space occupied by this element and its chain link. */ 254 /* Add in the space occupied by this element and its chain link. */
256 size_so_far += sizeof (struct Lisp_Cons); 255 size_so_far += sizeof (struct Lisp_Cons);
@@ -259,18 +258,17 @@ truncate_undo_list (list, minsize, maxsize)
259 prev = next; 258 prev = next;
260 next = XCONS (next)->cdr; 259 next = XCONS (next)->cdr;
261 } 260 }
262 while (XTYPE (next) == Lisp_Cons 261 while (CONSP (next) && ! NILP (XCONS (next)->car))
263 && ! NILP (XCONS (next)->car))
264 { 262 {
265 Lisp_Object elt; 263 Lisp_Object elt;
266 elt = XCONS (next)->car; 264 elt = XCONS (next)->car;
267 265
268 /* Add in the space occupied by this element and its chain link. */ 266 /* Add in the space occupied by this element and its chain link. */
269 size_so_far += sizeof (struct Lisp_Cons); 267 size_so_far += sizeof (struct Lisp_Cons);
270 if (XTYPE (elt) == Lisp_Cons) 268 if (CONSP (elt))
271 { 269 {
272 size_so_far += sizeof (struct Lisp_Cons); 270 size_so_far += sizeof (struct Lisp_Cons);
273 if (XTYPE (XCONS (elt)->car) == Lisp_String) 271 if (STRINGP (XCONS (elt)->car))
274 size_so_far += (sizeof (struct Lisp_String) - 1 272 size_so_far += (sizeof (struct Lisp_String) - 1
275 + XSTRING (XCONS (elt)->car)->size); 273 + XSTRING (XCONS (elt)->car)->size);
276 } 274 }
@@ -279,10 +277,10 @@ truncate_undo_list (list, minsize, maxsize)
279 prev = next; 277 prev = next;
280 next = XCONS (next)->cdr; 278 next = XCONS (next)->cdr;
281 } 279 }
282 if (XTYPE (next) == Lisp_Cons) 280 if (CONSP (next))
283 last_boundary = prev; 281 last_boundary = prev;
284 282
285 while (XTYPE (next) == Lisp_Cons) 283 while (CONSP (next))
286 { 284 {
287 Lisp_Object elt; 285 Lisp_Object elt;
288 elt = XCONS (next)->car; 286 elt = XCONS (next)->car;
@@ -302,10 +300,10 @@ truncate_undo_list (list, minsize, maxsize)
302 300
303 /* Add in the space occupied by this element and its chain link. */ 301 /* Add in the space occupied by this element and its chain link. */
304 size_so_far += sizeof (struct Lisp_Cons); 302 size_so_far += sizeof (struct Lisp_Cons);
305 if (XTYPE (elt) == Lisp_Cons) 303 if (CONSP (elt))
306 { 304 {
307 size_so_far += sizeof (struct Lisp_Cons); 305 size_so_far += sizeof (struct Lisp_Cons);
308 if (XTYPE (XCONS (elt)->car) == Lisp_String) 306 if (STRINGP (XCONS (elt)->car))
309 size_so_far += (sizeof (struct Lisp_String) - 1 307 size_so_far += (sizeof (struct Lisp_String) - 1
310 + XSTRING (XCONS (elt)->car)->size); 308 + XSTRING (XCONS (elt)->car)->size);
311 } 309 }
@@ -369,9 +367,9 @@ Return what remains of the list.")
369 if (NILP (next)) 367 if (NILP (next))
370 break; 368 break;
371 /* Handle an integer by setting point to that value. */ 369 /* Handle an integer by setting point to that value. */
372 if (XTYPE (next) == Lisp_Int) 370 if (INTEGERP (next))
373 SET_PT (clip_to_bounds (BEGV, XINT (next), ZV)); 371 SET_PT (clip_to_bounds (BEGV, XINT (next), ZV));
374 else if (XTYPE (next) == Lisp_Cons) 372 else if (CONSP (next))
375 { 373 {
376 Lisp_Object car, cdr; 374 Lisp_Object car, cdr;
377 375
@@ -412,7 +410,7 @@ Return what remains of the list.")
412 Fput_text_property (beg, end, prop, val, Qnil); 410 Fput_text_property (beg, end, prop, val, Qnil);
413 } 411 }
414#endif /* USE_TEXT_PROPERTIES */ 412#endif /* USE_TEXT_PROPERTIES */
415 else if (XTYPE (car) == Lisp_Int && XTYPE (cdr) == Lisp_Int) 413 else if (INTEGERP (car) && INTEGERP (cdr))
416 { 414 {
417 /* Element (BEG . END) means range was inserted. */ 415 /* Element (BEG . END) means range was inserted. */
418 Lisp_Object end; 416 Lisp_Object end;
@@ -425,7 +423,7 @@ Return what remains of the list.")
425 Fgoto_char (car); 423 Fgoto_char (car);
426 Fdelete_region (car, cdr); 424 Fdelete_region (car, cdr);
427 } 425 }
428 else if (XTYPE (car) == Lisp_String && XTYPE (cdr) == Lisp_Int) 426 else if (STRINGP (car) && INTEGERP (cdr))
429 { 427 {
430 /* Element (STRING . POS) means STRING was deleted. */ 428 /* Element (STRING . POS) means STRING was deleted. */
431 Lisp_Object membuf; 429 Lisp_Object membuf;