diff options
| author | Jim Blandy | 1993-03-31 10:55:33 +0000 |
|---|---|---|
| committer | Jim Blandy | 1993-03-31 10:55:33 +0000 |
| commit | 9ac0d9e04198806161ea21e49b0be04e5253fa57 (patch) | |
| tree | 66bd402e5ebbb6f362446a2baee28245cd953c8f /src/buffer.c | |
| parent | 357f32fcd0e00337a3c1359a4919e716ed81fe52 (diff) | |
| download | emacs-9ac0d9e04198806161ea21e49b0be04e5253fa57.tar.gz emacs-9ac0d9e04198806161ea21e49b0be04e5253fa57.zip | |
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.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/buffer.c b/src/buffer.c index edf04aa2e64..ddfab45d148 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -197,12 +197,12 @@ The value is never nil.") | |||
| 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 | ||
| @@ -750,7 +750,9 @@ with `delete-process'.") | |||
| 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; |
| @@ -1513,7 +1515,7 @@ DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0, | |||
| 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 | ||
| @@ -1553,7 +1555,7 @@ DEFUN ("next-overlay-change", Fnext_overlay_change, Snext_overlay_change, | |||
| 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 | ||