Mercurial > emacs
comparison src/buffer.c @ 2439:b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
This isn't specific to X, and it allows us to avoid #including
xterm.h in files that don't really have anything to do with X.
* blockinput.h: New file.
* xterm.h (BLOCK_INPUT, UNBLOCK_INPUT, TOTALLY_UNBLOCK_INPUT,
UNBLOCK_INPUT_RESIGNAL): These are now in blockinput.h.
(x_input_blocked, x_pending_input): Deleted; there are analogs
in blockinput.h called interrupt_input_blocked and
interrupt_input_pending.
* keyboard.c (interrupt_input_blocked, interrupt_input_pending):
New variables, used by the macros in blockinput.h.
* xterm.c: #include blockinput.h.
(x_input_blocked, x_pending_input): Deleted.
(XTread_socket): Test and set interrupt_input_blocked and
interrupt_input_pending instead of the old variables.
* alloc.c, xfaces.c, xfns.c, xmenu.c, xselect.c, keymap.c:
#include blockinput.h.
* eval.c: #include blockinput.h instead of xterm.h.
* keyboard.c: #include blockinput.h.
(input_poll_signal): Just test
interrupt_input_blocked, instead of testing HAVE_X_WINDOWS and
x_input_blocked.
Block the processing of interrupt input while we're manipulating the
malloc heap.
* alloc.c: (xfree): New function, to make it easy to free things
safely.
(xmalloc, xrealloc): Block X input while doing the deed.
(VALIDATE_LISP_STORAGE, gc_sweep, compact_strings): Use xfree
instead of free.
(uninterrupt_malloc): New function, to install input-blocking
hooks into the GNU malloc routines.
* emacs.c [not SYSTEM_MALLOC] (main): Call uninterrupt_malloc
on startup.
* alloc.c: (make_interval, make_float, Fcons, Fmake_vector,
Fmake_symbol, Fmake_marker, make_uninit_string, Fgarbage_collect):
Use xmalloc instead of malloc; don't bother to check if out of
memory here.
(Fgarbage_collect): Call xrealloc instead of realloc.
* buffer.c: Use xmalloc and xfree instead of malloc and free;
don't bother to check if out of memory here.
(Fget_buffer_create): Put BLOCK_INPUT/UNBLOCK_INPUT pair around
calls to ralloc routines.
* insdel.c: Same.
* lisp.h (xfree): New extern declaration.
* xfaces.c (xfree): Don't #define this to be free; use the
definition in alloc.c.
* dispnew.c, doc.c, doprnt.c, fileio.c, lread.c, term.c, xfns.c,
xmenu.c, xterm.c: Use xfree instead of free.
* hftctl.c: Use xfree and xmalloc instead of free and malloc.
* keymap.c (current_minor_maps): BLOCK_INPUT while calling realloc
and malloc.
* search.c: Since the regexp routines can malloc, BLOCK_INPUT
while runing them. #include blockinput.h.
* sysdep.c: #include blockinput.h. Call xfree and xmalloc instead
of free and malloc. BLOCK_INPUT around routines which we know
will call malloc.
ymakefile (keyboard.o, keymap.o, search.o, sysdep.o, xfaces.o,
xfns.o, xmenu.o, xterm.o, xselect.o, alloc.o, eval.o): Note that
these depend on blockinput.h.
| author | Jim Blandy <jimb@redhat.com> |
|---|---|
| date | Wed, 31 Mar 1993 10:55:33 +0000 |
| parents | 6048be0eedcd |
| children | 6f4b9c548425 |
comparison
equal
deleted
inserted
replaced
| 2438:b513de4de386 | 2439:b6c62e4abf59 |
|---|---|
| 195 | 195 |
| 196 buf = Fget_buffer (name); | 196 buf = Fget_buffer (name); |
| 197 if (!NILP (buf)) | 197 if (!NILP (buf)) |
| 198 return buf; | 198 return buf; |
| 199 | 199 |
| 200 b = (struct buffer *) malloc (sizeof (struct buffer)); | 200 b = (struct buffer *) xmalloc (sizeof (struct buffer)); |
| 201 if (!b) | |
| 202 memory_full (); | |
| 203 | 201 |
| 204 BUF_GAP_SIZE (b) = 20; | 202 BUF_GAP_SIZE (b) = 20; |
| 203 BLOCK_INPUT; | |
| 205 BUFFER_ALLOC (BUF_BEG_ADDR (b), BUF_GAP_SIZE (b)); | 204 BUFFER_ALLOC (BUF_BEG_ADDR (b), BUF_GAP_SIZE (b)); |
| 205 UNBLOCK_INPUT; | |
| 206 if (! BUF_BEG_ADDR (b)) | 206 if (! BUF_BEG_ADDR (b)) |
| 207 memory_full (); | 207 memory_full (); |
| 208 | 208 |
| 209 BUF_PT (b) = 1; | 209 BUF_PT (b) = 1; |
| 210 BUF_GPT (b) = 1; | 210 BUF_GPT (b) = 1; |
| 748 /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ | 748 /* Only defined if Emacs is compiled with USE_TEXT_PROPERTIES */ |
| 749 INITIALIZE_INTERVAL (b, NULL_INTERVAL); | 749 INITIALIZE_INTERVAL (b, NULL_INTERVAL); |
| 750 /* Perhaps we should explicitly free the interval tree here... */ | 750 /* Perhaps we should explicitly free the interval tree here... */ |
| 751 | 751 |
| 752 b->name = Qnil; | 752 b->name = Qnil; |
| 753 BLOCK_INPUT; | |
| 753 BUFFER_FREE (BUF_BEG_ADDR (b)); | 754 BUFFER_FREE (BUF_BEG_ADDR (b)); |
| 755 UNBLOCK_INPUT; | |
| 754 b->undo_list = Qnil; | 756 b->undo_list = Qnil; |
| 755 | 757 |
| 756 return Qt; | 758 return Qt; |
| 757 } | 759 } |
| 758 | 760 |
| 1511 noverlays = overlays_at (XINT (pos), &overlay_vec, &len, &endpos); | 1513 noverlays = overlays_at (XINT (pos), &overlay_vec, &len, &endpos); |
| 1512 | 1514 |
| 1513 /* Make a list of them all. */ | 1515 /* Make a list of them all. */ |
| 1514 result = Flist (noverlays, overlay_vec); | 1516 result = Flist (noverlays, overlay_vec); |
| 1515 | 1517 |
| 1516 free (overlay_vec); | 1518 xfree (overlay_vec); |
| 1517 return result; | 1519 return result; |
| 1518 } | 1520 } |
| 1519 | 1521 |
| 1520 DEFUN ("next-overlay-change", Fnext_overlay_change, Snext_overlay_change, | 1522 DEFUN ("next-overlay-change", Fnext_overlay_change, Snext_overlay_change, |
| 1521 1, 1, 0, | 1523 1, 1, 0, |
| 1551 oendpos = OVERLAY_POSITION (oend); | 1553 oendpos = OVERLAY_POSITION (oend); |
| 1552 if (oendpos < endpos) | 1554 if (oendpos < endpos) |
| 1553 endpos = oendpos; | 1555 endpos = oendpos; |
| 1554 } | 1556 } |
| 1555 | 1557 |
| 1556 free (overlay_vec); | 1558 xfree (overlay_vec); |
| 1557 return make_number (endpos); | 1559 return make_number (endpos); |
| 1558 } | 1560 } |
| 1559 | 1561 |
| 1560 /* These functions are for debugging overlays. */ | 1562 /* These functions are for debugging overlays. */ |
| 1561 | 1563 |
