From d7a7fda3cc130edb8bc10af96d322d263afbb44a Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Mon, 23 Jul 2012 15:15:43 +0400 Subject: Cleanup miscellaneous objects allocation and initialization. * alloc.c (allocate_misc): Change to static. Add argument to specify the subtype. Adjust comment and users. (build_overlay): New function. * buffer.c (copy_overlays, Fmake_overlay): Use it. * lisp.h (struct Lisp_Overlay): Remove obsolete comment. (allocate_misc): Remove prototype. (build_overlay): Add prototype. --- src/buffer.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/buffer.c') diff --git a/src/buffer.c b/src/buffer.c index 68208d17abe..734ddb5a1c1 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -433,12 +433,8 @@ copy_overlays (struct buffer *b, struct Lisp_Overlay *list) XMARKER (end)->insertion_type = XMARKER (OVERLAY_END (old_overlay))->insertion_type; - overlay = allocate_misc (); - XMISCTYPE (overlay) = Lisp_Misc_Overlay; - OVERLAY_START (overlay) = start; - OVERLAY_END (overlay) = end; - OVERLAY_PLIST (overlay) = Fcopy_sequence (OVERLAY_PLIST (old_overlay)); - XOVERLAY (overlay)->next = NULL; + overlay = build_overlay + (start, end, Fcopy_sequence (OVERLAY_PLIST (old_overlay))); if (tail) tail = tail->next = XOVERLAY (overlay); @@ -3640,12 +3636,7 @@ for the rear of the overlay advance when text is inserted there if (!NILP (rear_advance)) XMARKER (end)->insertion_type = 1; - overlay = allocate_misc (); - XMISCTYPE (overlay) = Lisp_Misc_Overlay; - XOVERLAY (overlay)->start = beg; - XOVERLAY (overlay)->end = end; - XOVERLAY (overlay)->plist = Qnil; - XOVERLAY (overlay)->next = NULL; + overlay = build_overlay (beg, end, Qnil); /* Put the new overlay on the wrong list. */ end = OVERLAY_END (overlay); -- cgit v1.2.1