diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d2266f9952f..99d50511b88 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,20 @@ +2012-09-20 Chong Yidong + + * vc/diff.el (diff-latest-backup-file): Autoload. + +2012-09-20 Stefan Monnier + + * calc/calc.el: Remove redundant autoload shape check. + (sel-mode): Don't defvar. + (calc-get-stack-element): Add `sel-mode' arg instead. + (calc-top, calc-top-list): Pass it this additional argument. + * calc/calc-store.el (calc-store-map): + * calc/calc-map.el (calc-apply, calc-reduce, calc-map) + (calc-map-equation, calc-outer-product, calc-inner-product): + * calc/calc-aent.el (calc-alg-entry): Don't bind sel-mode. + + * emacs-lisp/macroexp.el (macroexp--expand-all): Fix last change. + 2012-09-19 Juri Linkov * dired-aux.el (dired-diff): Add (require 'diff) because diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el index 4b91a8c2002..4cca7fb7e7f 100644 --- a/lisp/calc/calc-aent.el +++ b/lisp/calc/calc-aent.el @@ -286,8 +286,7 @@ The value t means abort and give an error message.") ;;;###autoload (defun calc-alg-entry (&optional initial prompt) - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (calc-plain-entry t) diff --git a/lisp/calc/calc-map.el b/lisp/calc/calc-map.el index 2519e960e0e..9276e1a7832 100644 --- a/lisp/calc/calc-map.el +++ b/lisp/calc/calc-map.el @@ -32,8 +32,7 @@ (defun calc-apply (&optional oper) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (oper (or oper (calc-get-operator "Apply" @@ -53,11 +52,10 @@ (defun calc-reduce (&optional oper accum) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (nest (calc-is-hyperbolic)) + (let* ((nest (calc-is-hyperbolic)) (rev (calc-is-inverse)) (nargs (if (and nest (not rev)) 2 1)) - (calc-dollar-values (mapcar 'calc-get-stack-element + (calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (calc-mapping-dir (and (not accum) (not nest) "")) @@ -99,8 +97,7 @@ (defun calc-map (&optional oper) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (calc-mapping-dir "") @@ -120,8 +117,7 @@ (defun calc-map-equation (&optional oper) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (oper (or oper (calc-get-operator "Map-equation"))) @@ -152,8 +148,7 @@ (defun calc-outer-product (&optional oper) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (oper (or oper (calc-get-operator "Outer" 2)))) @@ -170,8 +165,7 @@ (defun calc-inner-product (&optional mul-oper add-oper) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (mul-oper (or mul-oper (calc-get-operator "Inner (Mult)" 2))) diff --git a/lisp/calc/calc-store.el b/lisp/calc/calc-store.el index 80d355ed5fa..64df10a40ca 100644 --- a/lisp/calc/calc-store.el +++ b/lisp/calc/calc-store.el @@ -235,8 +235,7 @@ (defun calc-store-map (&optional oper var) (interactive) (calc-wrapper - (let* ((sel-mode nil) - (calc-dollar-values (mapcar 'calc-get-stack-element + (let* ((calc-dollar-values (mapcar #'calc-get-stack-element (nthcdr calc-stack-top calc-stack))) (calc-dollar-used 0) (oper (or oper (calc-get-operator "Store Mapping"))) diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 17f0998d30b..8e49693562d 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -914,8 +914,7 @@ Used by `calc-user-invocation'.") ;; Set up the autoloading linkage. (let ((name (and (fboundp 'calc-dispatch) - (autoloadp (symbol-function 'calc-dispatch)) - (nth 1 (symbol-function 'calc-dispatch)))) + (autoloadp (symbol-function 'calc-dispatch)))) (p load-path)) ;; If Calc files exist on the load-path, we're all set. @@ -1353,12 +1352,12 @@ Notations: 3.14e6 3.14 * 10^6 \\{calc-mode-map} " (interactive) - (mapc (function + (mapc (function ;FIXME: Why (set-default v (symbol-value v)) ?!?!? (lambda (v) (set-default v (symbol-value v)))) calc-local-var-list) (kill-all-local-variables) (use-local-map (if (eq calc-algebraic-mode 'total) (progn (require 'calc-ext) calc-alg-map) calc-mode-map)) - (mapc (function (lambda (v) (make-local-variable v))) calc-local-var-list) + (mapc #'make-local-variable calc-local-var-list) (make-local-variable 'overlay-arrow-position) (make-local-variable 'overlay-arrow-string) (add-hook 'change-major-mode-hook 'font-lock-defontify nil t) @@ -1395,7 +1394,7 @@ Notations: 3.14e6 3.14 * 10^6 (if calc-buffer-list (setq calc-stack (copy-sequence calc-stack))) (add-to-list 'calc-buffer-list (current-buffer) t)) -(defvar calc-check-defines 'calc-check-defines) ; suitable for run-hooks +(defvar calc-check-defines 'calc-check-defines) ; Suitable for run-hooks. (defun calc-check-defines () (if (symbol-plist 'calc-define) (let ((plist (copy-sequence (symbol-plist 'calc-define)))) @@ -1943,8 +1942,7 @@ See calc-keypad for details." (delete-region (point) (point-max)))) (calc-set-command-flag 'renum-stack)))))) -(defvar sel-mode) -(defun calc-get-stack-element (x) +(defun calc-get-stack-element (x &optional sel-mode) (cond ((eq sel-mode 'entry) x) ((eq sel-mode 'sel) @@ -1961,9 +1959,9 @@ See calc-keypad for details." (defun calc-top (&optional n sel-mode) (or n (setq n 1)) (calc-check-stack n) - (calc-get-stack-element (nth (+ n calc-stack-top -1) calc-stack))) + (calc-get-stack-element (nth (+ n calc-stack-top -1) calc-stack) sel-mode)) -(defun calc-top-n (&optional n sel-mode) ; in case precision has changed +(defun calc-top-n (&optional n sel-mode) ; In case precision has changed. (math-check-complete (calc-normalize (calc-top n sel-mode)))) (defun calc-top-list (&optional n m sel-mode) @@ -1974,7 +1972,8 @@ See calc-keypad for details." (let ((top (copy-sequence (nthcdr (+ m calc-stack-top -1) calc-stack)))) (setcdr (nthcdr (1- n) top) nil) - (nreverse (mapcar 'calc-get-stack-element top))))) + (nreverse + (mapcar (lambda (x) (calc-get-stack-element x sel-mode)) top))))) (defun calc-top-list-n (&optional n m sel-mode) (mapcar 'math-check-complete diff --git a/lisp/dired.el b/lisp/dired.el index 0f453fe8f5d..364ba9f6d47 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -3763,7 +3763,7 @@ Ask means pop up a menu for the user to select one of copy, move or link." ;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command ;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown ;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff -;;;;;; dired-diff) "dired-aux" "dired-aux.el" "2a883f0d481a8d0292eb90c09ae36a8e") +;;;;;; dired-diff) "dired-aux" "dired-aux.el" "cab4c9952dac1073157ff3fa23cd93b8") ;;; Generated autoloads from dired-aux.el (autoload 'dired-diff "dired-aux" "\ diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index 6a84be06728..f9be3e4fcc4 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -149,7 +149,7 @@ Assumes the caller has bound `macroexpand-all-environment'." (symbolp (car form)) (get (car form) 'byte-obsolete-info)) (macroexp--funcall-and-return - (lambda () (byte-compile-warn-obsolete ',(car form))) + (lambda () (byte-compile-warn-obsolete (car form))) #'ignore ;FIXME: We should `message' something. new-form) new-form))) diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el index b70b6cd919c..b1c334ddcfc 100644 --- a/lisp/vc/diff.el +++ b/lisp/vc/diff.el @@ -197,7 +197,8 @@ With prefix arg, prompt for diff switches." ori file)) (diff bak ori switches))) -(defun diff-latest-backup-file (fn) ; actually belongs into files.el +;;;###autoload +(defun diff-latest-backup-file (fn) "Return the latest existing backup of FILE, or nil." (let ((handler (find-file-name-handler fn 'diff-latest-backup-file))) (if handler diff --git a/src/ChangeLog b/src/ChangeLog index e8827c2de18..c3ce1ee1b0b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,29 @@ +2012-09-20 Stefan Monnier + + * alloc.c (mark_object) : Mark prev/next_buffers *after* + calling mark_vectorlike since that's the one that marks the window. + (mark_discard_killed_buffers): Mark the final cdr. + * window.h (struct window): Move prev/next_buffers to the + non-standard fields. + * window.c (make_window): Initialize prev/next_buffers manually. + +2012-09-20 Paul Eggert + + Omit unused arg EXPECTED from socket hooks. + * keyboard.c (gobble_input, read_avail_input, tty_read_avail_input): + * nsterm.m (ns_term_init): + * termhooks.h (struct terminal.read_socket_hook): + * w32inevt.c (w32_console_read_socket): + * w32term.c (w32_read_socket): + * xterm.c (XTread_socket): + Omit unused arg EXPECTED. All callers changed. + (store_user_signal_events): Return void, not int, since callers no + longer care about the return value. All uses changed. + +2012-09-20 Juanma Barranquero + + * w32gui.h (XParseGeometry): Do not declare. + 2012-09-19 Paul Eggert * w32inevt.c (w32_console_read_socket): Return -1 on failure, not 0. diff --git a/src/alloc.c b/src/alloc.c index 61cb7086c25..02ba2f5f9e3 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -24,7 +24,6 @@ along with GNU Emacs. If not, see . */ #include #include /* For CHAR_BIT. */ -#include #ifdef ENABLE_CHECKING #include /* For SIGABRT. */ @@ -45,7 +44,7 @@ along with GNU Emacs. If not, see . */ #include "frame.h" #include "blockinput.h" #include "termhooks.h" /* For struct terminal. */ -#include + #include /* GC_CHECK_MARKED_OBJECTS means do sanity checks on allocated objects. @@ -86,66 +85,8 @@ extern void *sbrk (); #define MMAP_MAX_AREAS 100000000 -#else /* not DOUG_LEA_MALLOC */ - -/* The following come from gmalloc.c. */ - -extern size_t _bytes_used; -extern size_t __malloc_extra_blocks; -extern void *_malloc_internal (size_t); -extern void _free_internal (void *); - #endif /* not DOUG_LEA_MALLOC */ -#if ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT -#ifdef HAVE_PTHREAD - -/* When GTK uses the file chooser dialog, different backends can be loaded - dynamically. One such a backend is the Gnome VFS backend that gets loaded - if you run Gnome. That backend creates several threads and also allocates - memory with malloc. - - Also, gconf and gsettings may create several threads. - - If Emacs sets malloc hooks (! SYSTEM_MALLOC) and the emacs_blocked_* - functions below are called from malloc, there is a chance that one - of these threads preempts the Emacs main thread and the hook variables - end up in an inconsistent state. So we have a mutex to prevent that (note - that the backend handles concurrent access to malloc within its own threads - but Emacs code running in the main thread is not included in that control). - - When UNBLOCK_INPUT is called, reinvoke_input_signal may be called. If this - happens in one of the backend threads we will have two threads that tries - to run Emacs code at once, and the code is not prepared for that. - To prevent that, we only call BLOCK/UNBLOCK from the main thread. */ - -static pthread_mutex_t alloc_mutex; - -#define BLOCK_INPUT_ALLOC \ - do \ - { \ - if (pthread_equal (pthread_self (), main_thread)) \ - BLOCK_INPUT; \ - pthread_mutex_lock (&alloc_mutex); \ - } \ - while (0) -#define UNBLOCK_INPUT_ALLOC \ - do \ - { \ - pthread_mutex_unlock (&alloc_mutex); \ - if (pthread_equal (pthread_self (), main_thread)) \ - UNBLOCK_INPUT; \ - } \ - while (0) - -#else /* ! defined HAVE_PTHREAD */ - -#define BLOCK_INPUT_ALLOC BLOCK_INPUT -#define UNBLOCK_INPUT_ALLOC UNBLOCK_INPUT - -#endif /* ! defined HAVE_PTHREAD */ -#endif /* ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT */ - /* Mark, unmark, query mark bit of a Lisp string. S must be a pointer to a struct Lisp_String. */ @@ -204,10 +145,6 @@ static char *spare_memory[7]; #define SPARE_MEMORY (1 << 14) -/* Number of extra blocks malloc should get when it needs more core. */ - -static int malloc_hysteresis; - /* Initialize it to a nonzero value to force it into data space (rather than bss space). That way unexec will remap it into text space (pure), on some systems. We have not implemented the @@ -412,12 +349,12 @@ static void mark_memory (void *, void *); static void mem_init (void); static struct mem_node *mem_insert (void *, void *, enum mem_type); static void mem_insert_fixup (struct mem_node *); -#endif static void mem_rotate_left (struct mem_node *); static void mem_rotate_right (struct mem_node *); static void mem_delete (struct mem_node *); static void mem_delete_fixup (struct mem_node *); static inline struct mem_node *mem_find (void *); +#endif #if GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS @@ -586,39 +523,17 @@ xmalloc_get_size (unsigned char *ptr) } -/* The call depth in overrun_check functions. For example, this might happen: - xmalloc() - overrun_check_malloc() - -> malloc -> (via hook)_-> emacs_blocked_malloc - -> overrun_check_malloc - call malloc (hooks are NULL, so real malloc is called). - malloc returns 10000. - add overhead, return 10016. - <- (back in overrun_check_malloc) - add overhead again, return 10032 - xmalloc returns 10032. - - (time passes). - - xfree(10032) - overrun_check_free(10032) - decrease overhead - free(10016) <- crash, because 10000 is the original pointer. */ - -static ptrdiff_t check_depth; - /* Like malloc, but wraps allocated block with header and trailer. */ static void * overrun_check_malloc (size_t size) { register unsigned char *val; - int overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_OVERHEAD : 0; - if (SIZE_MAX - overhead < size) + if (SIZE_MAX - XMALLOC_OVERRUN_CHECK_OVERHEAD < size) emacs_abort (); - val = malloc (size + overhead); - if (val && check_depth == 1) + val = malloc (size + XMALLOC_OVERRUN_CHECK_OVERHEAD); + if (val) { memcpy (val, xmalloc_overrun_check_header, XMALLOC_OVERRUN_CHECK_SIZE); val += XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE; @@ -626,7 +541,6 @@ overrun_check_malloc (size_t size) memcpy (val + size, xmalloc_overrun_check_trailer, XMALLOC_OVERRUN_CHECK_SIZE); } - --check_depth; return val; } @@ -638,12 +552,10 @@ static void * overrun_check_realloc (void *block, size_t size) { register unsigned char *val = (unsigned char *) block; - int overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_OVERHEAD : 0; - if (SIZE_MAX - overhead < size) + if (SIZE_MAX - XMALLOC_OVERRUN_CHECK_OVERHEAD < size) emacs_abort (); if (val - && check_depth == 1 && memcmp (xmalloc_overrun_check_header, val - XMALLOC_OVERRUN_CHECK_SIZE - XMALLOC_OVERRUN_SIZE_SIZE, XMALLOC_OVERRUN_CHECK_SIZE) == 0) @@ -657,9 +569,9 @@ overrun_check_realloc (void *block, size_t size) memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE); } - val = realloc (val, size + overhead); + val = realloc (val, size + XMALLOC_OVERRUN_CHECK_OVERHEAD); - if (val && check_depth == 1) + if (val) { memcpy (val, xmalloc_overrun_check_header, XMALLOC_OVERRUN_CHECK_SIZE); val += XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE; @@ -667,7 +579,6 @@ overrun_check_realloc (void *block, size_t size) memcpy (val + size, xmalloc_overrun_check_trailer, XMALLOC_OVERRUN_CHECK_SIZE); } - --check_depth; return val; } @@ -678,9 +589,7 @@ overrun_check_free (void *block) { unsigned char *val = (unsigned char *) block; - ++check_depth; if (val - && check_depth == 1 && memcmp (xmalloc_overrun_check_header, val - XMALLOC_OVERRUN_CHECK_SIZE - XMALLOC_OVERRUN_SIZE_SIZE, XMALLOC_OVERRUN_CHECK_SIZE) == 0) @@ -700,7 +609,6 @@ overrun_check_free (void *block) } free (val); - --check_depth; } #undef malloc @@ -711,14 +619,33 @@ overrun_check_free (void *block) #define free overrun_check_free #endif -#ifdef SYNC_INPUT -/* When using SYNC_INPUT, we don't call malloc from a signal handler, so - there's no need to block input around malloc. */ -#define MALLOC_BLOCK_INPUT ((void)0) -#define MALLOC_UNBLOCK_INPUT ((void)0) +/* If compiled with XMALLOC_BLOCK_INPUT_CHECK, define a symbol + BLOCK_INPUT_IN_MEMORY_ALLOCATORS that is visible to the debugger. + If that variable is set, block input while in one of Emacs's memory + allocation functions. There should be no need for this debugging + option, since signal handlers do not allocate memory, but Emacs + formerly allocated memory in signal handlers and this compile-time + option remains as a way to help debug the issue should it rear its + ugly head again. */ +#ifdef XMALLOC_BLOCK_INPUT_CHECK +bool block_input_in_memory_allocators EXTERNALLY_VISIBLE; +static void +malloc_block_input (void) +{ + if (block_input_in_memory_allocators) + BLOCK_INPUT; +} +static void +malloc_unblock_input (void) +{ + if (block_input_in_memory_allocators) + UNBLOCK_INPUT; +} +# define MALLOC_BLOCK_INPUT malloc_block_input () +# define MALLOC_UNBLOCK_INPUT malloc_unblock_input () #else -#define MALLOC_BLOCK_INPUT BLOCK_INPUT -#define MALLOC_UNBLOCK_INPUT UNBLOCK_INPUT +# define MALLOC_BLOCK_INPUT ((void) 0) +# define MALLOC_UNBLOCK_INPUT ((void) 0) #endif /* Like malloc but check for no memory and block interrupt input.. */ @@ -787,8 +714,7 @@ xfree (void *block) free (block); MALLOC_UNBLOCK_INPUT; /* We don't call refill_memory_reserve here - because that duplicates doing so in emacs_blocked_free - and the criterion should go there. */ + because in practice the call in r_alloc_free seems to suffice. */ } @@ -1214,256 +1140,6 @@ lisp_align_free (void *block) MALLOC_UNBLOCK_INPUT; } - -#ifndef SYSTEM_MALLOC - -/* Arranging to disable input signals while we're in malloc. - - This only works with GNU malloc. To help out systems which can't - use GNU malloc, all the calls to malloc, realloc, and free - elsewhere in the code should be inside a BLOCK_INPUT/UNBLOCK_INPUT - pair; unfortunately, we have no idea what C library functions - might call malloc, so we can't really protect them unless you're - using GNU malloc. Fortunately, most of the major operating systems - can use GNU malloc. */ - -#ifndef SYNC_INPUT -/* When using SYNC_INPUT, we don't call malloc from a signal handler, so - there's no need to block input around malloc. */ - -#ifndef DOUG_LEA_MALLOC -extern void * (*__malloc_hook) (size_t, const void *); -extern void * (*__realloc_hook) (void *, size_t, const void *); -extern void (*__free_hook) (void *, const void *); -/* Else declared in malloc.h, perhaps with an extra arg. */ -#endif /* DOUG_LEA_MALLOC */ -static void * (*old_malloc_hook) (size_t, const void *); -static void * (*old_realloc_hook) (void *, size_t, const void*); -static void (*old_free_hook) (void*, const void*); - -#ifdef DOUG_LEA_MALLOC -# define BYTES_USED (mallinfo ().uordblks) -#else -# define BYTES_USED _bytes_used -#endif - -#ifdef GC_MALLOC_CHECK -static bool dont_register_blocks; -#endif - -static size_t bytes_used_when_reconsidered; - -/* Value of _bytes_used, when spare_memory was freed. */ - -static size_t bytes_used_when_full; - -/* This function is used as the hook for free to call. */ - -static void -emacs_blocked_free (void *ptr, const void *ptr2) -{ - BLOCK_INPUT_ALLOC; - -#ifdef GC_MALLOC_CHECK - if (ptr) - { - struct mem_node *m; - - m = mem_find (ptr); - if (m == MEM_NIL || m->start != ptr) - { - fprintf (stderr, - "Freeing `%p' which wasn't allocated with malloc\n", ptr); - emacs_abort (); - } - else - { - /* fprintf (stderr, "free %p...%p (%p)\n", m->start, m->end, ptr); */ - mem_delete (m); - } - } -#endif /* GC_MALLOC_CHECK */ - - __free_hook = old_free_hook; - free (ptr); - - /* If we released our reserve (due to running out of memory), - and we have a fair amount free once again, - try to set aside another reserve in case we run out once more. */ - if (! NILP (Vmemory_full) - /* Verify there is enough space that even with the malloc - hysteresis this call won't run out again. - The code here is correct as long as SPARE_MEMORY - is substantially larger than the block size malloc uses. */ - && (bytes_used_when_full - > ((bytes_used_when_reconsidered = BYTES_USED) - + max (malloc_hysteresis, 4) * SPARE_MEMORY))) - refill_memory_reserve (); - - __free_hook = emacs_blocked_free; - UNBLOCK_INPUT_ALLOC; -} - - -/* This function is the malloc hook that Emacs uses. */ - -static void * -emacs_blocked_malloc (size_t size, const void *ptr) -{ - void *value; - - BLOCK_INPUT_ALLOC; - __malloc_hook = old_malloc_hook; -#ifdef DOUG_LEA_MALLOC - /* Segfaults on my system. --lorentey */ - /* mallopt (M_TOP_PAD, malloc_hysteresis * 4096); */ -#else - __malloc_extra_blocks = malloc_hysteresis; -#endif - - value = malloc (size); - -#ifdef GC_MALLOC_CHECK - { - struct mem_node *m = mem_find (value); - if (m != MEM_NIL) - { - fprintf (stderr, "Malloc returned %p which is already in use\n", - value); - fprintf (stderr, "Region in use is %p...%p, %td bytes, type %d\n", - m->start, m->end, (char *) m->end - (char *) m->start, - m->type); - emacs_abort (); - } - - if (!dont_register_blocks) - { - mem_insert (value, (char *) value + max (1, size), allocated_mem_type); - allocated_mem_type = MEM_TYPE_NON_LISP; - } - } -#endif /* GC_MALLOC_CHECK */ - - __malloc_hook = emacs_blocked_malloc; - UNBLOCK_INPUT_ALLOC; - - /* fprintf (stderr, "%p malloc\n", value); */ - return value; -} - - -/* This function is the realloc hook that Emacs uses. */ - -static void * -emacs_blocked_realloc (void *ptr, size_t size, const void *ptr2) -{ - void *value; - - BLOCK_INPUT_ALLOC; - __realloc_hook = old_realloc_hook; - -#ifdef GC_MALLOC_CHECK - if (ptr) - { - struct mem_node *m = mem_find (ptr); - if (m == MEM_NIL || m->start != ptr) - { - fprintf (stderr, - "Realloc of %p which wasn't allocated with malloc\n", - ptr); - emacs_abort (); - } - - mem_delete (m); - } - - /* fprintf (stderr, "%p -> realloc\n", ptr); */ - - /* Prevent malloc from registering blocks. */ - dont_register_blocks = 1; -#endif /* GC_MALLOC_CHECK */ - - value = realloc (ptr, size); - -#ifdef GC_MALLOC_CHECK - dont_register_blocks = 0; - - { - struct mem_node *m = mem_find (value); - if (m != MEM_NIL) - { - fprintf (stderr, "Realloc returns memory that is already in use\n"); - emacs_abort (); - } - - /* Can't handle zero size regions in the red-black tree. */ - mem_insert (value, (char *) value + max (size, 1), MEM_TYPE_NON_LISP); - } - - /* fprintf (stderr, "%p <- realloc\n", value); */ -#endif /* GC_MALLOC_CHECK */ - - __realloc_hook = emacs_blocked_realloc; - UNBLOCK_INPUT_ALLOC; - - return value; -} - - -#ifdef HAVE_PTHREAD -/* Called from Fdump_emacs so that when the dumped Emacs starts, it has a - normal malloc. Some thread implementations need this as they call - malloc before main. The pthread_self call in BLOCK_INPUT_ALLOC then - calls malloc because it is the first call, and we have an endless loop. */ - -void -reset_malloc_hooks (void) -{ - __free_hook = old_free_hook; - __malloc_hook = old_malloc_hook; - __realloc_hook = old_realloc_hook; -} -#endif /* HAVE_PTHREAD */ - - -/* Called from main to set up malloc to use our hooks. */ - -void -uninterrupt_malloc (void) -{ -#ifdef HAVE_PTHREAD -#ifdef DOUG_LEA_MALLOC - pthread_mutexattr_t attr; - - /* GLIBC has a faster way to do this, but let's keep it portable. - This is according to the Single UNIX Specification. */ - pthread_mutexattr_init (&attr); - pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE); - pthread_mutex_init (&alloc_mutex, &attr); -#else /* !DOUG_LEA_MALLOC */ - /* Some systems such as Solaris 2.6 don't have a recursive mutex, - and the bundled gmalloc.c doesn't require it. */ - pthread_mutex_init (&alloc_mutex, NULL); -#endif /* !DOUG_LEA_MALLOC */ -#endif /* HAVE_PTHREAD */ - - if (__free_hook != emacs_blocked_free) - old_free_hook = __free_hook; - __free_hook = emacs_blocked_free; - - if (__malloc_hook != emacs_blocked_malloc) - old_malloc_hook = __malloc_hook; - __malloc_hook = emacs_blocked_malloc; - - if (__realloc_hook != emacs_blocked_realloc) - old_realloc_hook = __realloc_hook; - __realloc_hook = emacs_blocked_realloc; -} - -#endif /* not SYNC_INPUT */ -#endif /* not SYSTEM_MALLOC */ - - /*********************************************************************** Interval Allocation @@ -1510,8 +1186,6 @@ make_interval (void) { INTERVAL val; - /* eassert (!handling_signal); */ - MALLOC_BLOCK_INPUT; if (interval_free_list) @@ -1895,8 +1569,6 @@ allocate_string (void) { struct Lisp_String *s; - /* eassert (!handling_signal); */ - MALLOC_BLOCK_INPUT; /* If the free-list is empty, allocate a new string_block, and @@ -2588,8 +2260,6 @@ make_float (double float_value) { register Lisp_Object val; - /* eassert (!handling_signal); */ - MALLOC_BLOCK_INPUT; if (float_free_list) @@ -2697,8 +2367,6 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0, { register Lisp_Object val; - /* eassert (!handling_signal); */ - MALLOC_BLOCK_INPUT; if (cons_free_list) @@ -3204,9 +2872,6 @@ allocate_vectorlike (ptrdiff_t len) MALLOC_BLOCK_INPUT; - /* This gets triggered by code which I haven't bothered to fix. --Stef */ - /* eassert (!handling_signal); */ - if (len == 0) p = XVECTOR (zero_vector); else @@ -3491,8 +3156,6 @@ Its value and function definition are void, and its property list is nil. */) CHECK_STRING (name); - /* eassert (!handling_signal); */ - MALLOC_BLOCK_INPUT; if (symbol_free_list) @@ -3577,8 +3240,6 @@ allocate_misc (enum Lisp_Misc_Type type) { Lisp_Object val; - /* eassert (!handling_signal); */ - MALLOC_BLOCK_INPUT; if (marker_free_list) @@ -3798,12 +3459,6 @@ memory_full (size_t nbytes) lisp_free (spare_memory[i]); spare_memory[i] = 0; } - - /* Record the space now used. When it decreases substantially, - we can refill the memory reserve. */ -#if !defined SYSTEM_MALLOC && !defined SYNC_INPUT - bytes_used_when_full = BYTES_USED; -#endif } /* This used to call error, but if we've run out of memory, we could @@ -3941,7 +3596,7 @@ mem_insert (void *start, void *end, enum mem_type type) /* Create a new node. */ #ifdef GC_MALLOC_CHECK - x = _malloc_internal (sizeof *x); + x = malloc (sizeof *x); if (x == NULL) emacs_abort (); #else @@ -4165,7 +3820,7 @@ mem_delete (struct mem_node *z) mem_delete_fixup (x); #ifdef GC_MALLOC_CHECK - _free_internal (y); + free (y); #else xfree (y); #endif @@ -4762,14 +4417,14 @@ test_setjmp (void) { char buf[10]; register int x; - jmp_buf jbuf; + sys_jmp_buf jbuf; /* Arrange for X to be put in a register. */ sprintf (buf, "1"); x = strlen (buf); x = 2 * x - 1; - _setjmp (jbuf); + sys_setjmp (jbuf); if (longjmps_done == 1) { /* Came here after the longjmp at the end of the function. @@ -4794,7 +4449,7 @@ test_setjmp (void) ++longjmps_done; x = 2; if (longjmps_done == 1) - _longjmp (jbuf, 1); + sys_longjmp (jbuf, 1); } #endif /* not GC_SAVE_REGISTERS_ON_STACK && not GC_SETJMP_WORKS */ @@ -4900,7 +4555,7 @@ mark_stack (void) /* jmp_buf may not be aligned enough on darwin-ppc64 */ union aligned_jmpbuf { Lisp_Object o; - jmp_buf j; + sys_jmp_buf j; } j; volatile bool stack_grows_down_p = (char *) &j > (char *) stack_base; #endif @@ -4936,7 +4591,7 @@ mark_stack (void) } #endif /* GC_SETJMP_WORKS */ - _setjmp (j.j); + sys_setjmp (j.j); end = stack_grows_down_p ? (char *) &j + sizeof j : (char *) &j; #endif /* not GC_SAVE_REGISTERS_ON_STACK */ #endif /* not HAVE___BUILTIN_UNWIND_INIT */ @@ -5865,16 +5520,16 @@ mark_buffer (struct buffer *buffer) mark_buffer (buffer->base_buffer); } -/* Remove killed buffers or items whose car is a killed buffer - from LIST and return changed LIST. Called during GC. */ +/* Remove killed buffers or items whose car is a killed buffer from + LIST, and mark other items. Return changed LIST, which is marked. */ static Lisp_Object -discard_killed_buffers (Lisp_Object list) +mark_discard_killed_buffers (Lisp_Object list) { - Lisp_Object *prev = &list; - Lisp_Object tail; + Lisp_Object tail, *prev = &list; - for (tail = list; CONSP (tail); tail = XCDR (tail)) + for (tail = list; CONSP (tail) && !CONS_MARKED_P (XCONS (tail)); + tail = XCDR (tail)) { Lisp_Object tem = XCAR (tail); if (CONSP (tem)) @@ -5882,8 +5537,13 @@ discard_killed_buffers (Lisp_Object list) if (BUFFERP (tem) && !BUFFER_LIVE_P (XBUFFER (tem))) *prev = XCDR (tail); else - prev = &XCDR_AS_LVALUE (tail); + { + CONS_MARK (XCONS (tail)); + mark_object (XCAR (tail)); + prev = &XCDR_AS_LVALUE (tail); + } } + mark_object (tail); return list; } @@ -6023,18 +5683,8 @@ mark_object (Lisp_Object arg) break; case PVEC_FRAME: - { - struct frame *f = (struct frame *) ptr; - - /* For live frames, killed buffers are filtered out by - store_frame_param. For dead frames, we do it here in - attempt to help GC to reclaim killed buffers faster. */ - if (!FRAME_LIVE_P (f)) - fset_buffer_list (f, discard_killed_buffers (f->buffer_list)); - - mark_vectorlike (ptr); - mark_face_cache (f->face_cache); - } + mark_vectorlike (ptr); + mark_face_cache (((struct frame *) ptr)->face_cache); break; case PVEC_WINDOW: @@ -6042,18 +5692,8 @@ mark_object (Lisp_Object arg) struct window *w = (struct window *) ptr; bool leaf = NILP (w->hchild) && NILP (w->vchild); - /* For live windows, Lisp code filters out killed buffers - from both buffer lists. For dead windows, we do it here - in attempt to help GC to reclaim killed buffers faster. */ - if (leaf && NILP (w->buffer)) - { - wset_prev_buffers - (w, discard_killed_buffers (w->prev_buffers)); - wset_next_buffers - (w, discard_killed_buffers (w->next_buffers)); - } - mark_vectorlike (ptr); + /* Mark glyphs for leaf windows. Marking window matrices is sufficient because frame matrices use the same glyph memory. */ @@ -6062,6 +5702,15 @@ mark_object (Lisp_Object arg) mark_glyph_matrix (w->current_matrix); mark_glyph_matrix (w->desired_matrix); } + + /* Filter out killed buffers from both buffer lists + in attempt to help GC to reclaim killed buffers faster. + We can do it elsewhere for live windows, but this is the + best place to do it for dead windows. */ + wset_prev_buffers + (w, mark_discard_killed_buffers (w->prev_buffers)); + wset_next_buffers + (w, mark_discard_killed_buffers (w->next_buffers)); } break; @@ -6772,12 +6421,6 @@ init_alloc_once (void) init_strings (); init_vectors (); -#ifdef REL_ALLOC - malloc_hysteresis = 32; -#else - malloc_hysteresis = 0; -#endif - refill_memory_reserve (); gc_cons_threshold = GC_DEFAULT_THRESHOLD; } diff --git a/src/dispnew.c b/src/dispnew.c index 9cc7349f1b0..f62ee9dc96e 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -5982,7 +5982,7 @@ sit_for (Lisp_Object timeout, bool reading, int do_display) #ifdef USABLE_SIGIO - gobble_input (0); + gobble_input (); #endif wait_reading_process_output (sec, nsec, reading ? -1 : 1, do_display, diff --git a/src/keyboard.c b/src/keyboard.c index c80f1d61e77..2c8d6fabf19 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -416,7 +416,7 @@ static EMACS_TIME timer_last_idleness_start_time; /* Function for init_keyboard to call with no args (if nonzero). */ static void (*keyboard_init_hook) (void); -static int read_avail_input (int); +static int read_avail_input (void); static void get_input_pending (int *, int); static int readable_events (int); static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *, @@ -451,7 +451,7 @@ static void timer_stop_idle (void); static void timer_resume_idle (void); static void deliver_user_signal (int); static char *find_user_signal_name (int); -static int store_user_signal_events (void); +static void store_user_signal_events (void); /* These setters are used only in this file, so they can be private. */ static inline void @@ -2013,7 +2013,7 @@ poll_for_input_1 (void) { if (interrupt_input_blocked == 0 && !waiting_for_input) - read_avail_input (0); + read_avail_input (); } /* Timer callback function for poll_timer. TIMER is equal to @@ -3846,7 +3846,7 @@ kbd_buffer_get_event (KBOARD **kbp, interrupt handlers have not read it, read it now. */ #ifdef USABLE_SIGIO - gobble_input (0); + gobble_input (); #endif if (kbd_fetch_ptr != kbd_store_ptr) break; @@ -3872,8 +3872,7 @@ kbd_buffer_get_event (KBOARD **kbp, wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0); if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr) - /* Pass 1 for EXPECT since we just waited to have input. */ - read_avail_input (1); + read_avail_input (); } if (CONSP (Vunread_command_events)) @@ -6750,14 +6749,14 @@ get_input_pending (int *addr, int flags) return; /* Try to read some input and see how much we get. */ - gobble_input (0); + gobble_input (); *addr = (!NILP (Vquit_flag) || readable_events (flags)); } /* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary. */ void -gobble_input (int expected) +gobble_input (void) { #ifdef USABLE_SIGIO if (interrupt_input) @@ -6766,7 +6765,7 @@ gobble_input (int expected) sigemptyset (&blocked); sigaddset (&blocked, SIGIO); pthread_sigmask (SIG_BLOCK, &blocked, &procmask); - read_avail_input (expected); + read_avail_input (); pthread_sigmask (SIG_SETMASK, &procmask, 0); } else @@ -6780,13 +6779,13 @@ gobble_input (int expected) sigemptyset (&blocked); sigaddset (&blocked, SIGALRM); pthread_sigmask (SIG_BLOCK, &blocked, &procmask); - read_avail_input (expected); + read_avail_input (); pthread_sigmask (SIG_SETMASK, &procmask, 0); } else #endif #endif - read_avail_input (expected); + read_avail_input (); } /* Put a BUFFER_SWITCH_EVENT in the buffer @@ -6842,15 +6841,14 @@ record_asynch_buffer_change (void) this is a bad time to try to read input. */ static int -read_avail_input (int expected) +read_avail_input (void) { int nread = 0; int err = 0; struct terminal *t; /* Store pending user signal events, if any. */ - if (store_user_signal_events ()) - expected = 0; + store_user_signal_events (); /* Loop through the available terminals, and call their input hooks. */ t = terminal_list; @@ -6867,11 +6865,8 @@ read_avail_input (int expected) hold_quit.kind = NO_EVENT; /* No need for FIONREAD or fcntl; just say don't wait. */ - while (nr = (*t->read_socket_hook) (t, expected, &hold_quit), nr > 0) - { - nread += nr; - expected = 0; - } + while (0 < (nr = (*t->read_socket_hook) (t, &hold_quit))) + nread += nr; if (nr == -1) /* Not OK to read input now. */ { @@ -6966,7 +6961,6 @@ decode_keyboard_code (struct tty_display_info *tty, int tty_read_avail_input (struct terminal *terminal, - int expected, struct input_event *hold_quit) { /* Using KBD_BUFFER_SIZE - 1 here avoids reading more than @@ -7186,8 +7180,7 @@ handle_async_input (void) while (1) { - int nread; - nread = read_avail_input (1); + int nread = read_avail_input (); /* -1 means it's not ok to read the input now. UNBLOCK_INPUT will read it later; now, avoid infinite loop. 0 means there was no keyboard input available. */ @@ -7339,25 +7332,25 @@ find_user_signal_name (int sig) return NULL; } -static int +static void store_user_signal_events (void) { struct user_signal_info *p; struct input_event buf; - int nstored = 0; + bool buf_initialized = 0; for (p = user_signals; p; p = p->next) if (p->npending > 0) { sigset_t blocked, procmask; - if (nstored == 0) + if (! buf_initialized) { memset (&buf, 0, sizeof buf); buf.kind = USER_SIGNAL_EVENT; buf.frame_or_window = selected_frame; + buf_initialized = 1; } - nstored += p->npending; sigemptyset (&blocked); sigaddset (&blocked, p->sig); @@ -7373,8 +7366,6 @@ store_user_signal_events (void) pthread_sigmask (SIG_SETMASK, &procmask, 0); } - - return nstored; } diff --git a/src/keyboard.h b/src/keyboard.h index 91484b3649b..3601f68be9f 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -523,7 +523,7 @@ extern void input_poll_signal (int); extern void start_polling (void); extern void stop_polling (void); extern void set_poll_suppress_count (int); -extern void gobble_input (int); +extern void gobble_input (void); extern int input_polling_used (void); extern void clear_input_pending (void); extern int requeued_events_pending_p (void); @@ -547,8 +547,7 @@ extern Lisp_Object menu_item_eval_property (Lisp_Object); extern int kbd_buffer_events_waiting (int); extern void add_user_signal (int, const char *); -extern int tty_read_avail_input (struct terminal *, int, - struct input_event *); +extern int tty_read_avail_input (struct terminal *, struct input_event *); extern EMACS_TIME timer_check (void); extern void mark_kboards (void); diff --git a/src/nsterm.m b/src/nsterm.m index f9611fd1210..aa869e3ff44 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -35,7 +35,6 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) #include #include #include -#include #include #include @@ -628,7 +627,7 @@ ns_update_begin (struct frame *f) { NSView *view = FRAME_NS_VIEW (f); NSRect r = [view frame]; - NSBezierPath *bp = [NSBezierPath bezierPath]; + NSBezierPath *bp; NSTRACE (ns_update_begin); ns_update_auto_hide_menu_bar (); @@ -640,8 +639,9 @@ ns_update_begin (struct frame *f) is for the minibuffer. But the display engine may draw more because we have set the frame as garbaged. So reset clip path to the whole view. */ - [bp appendBezierPathWithRect: r]; + bp = [[NSBezierPath bezierPathWithRect: r] retain]; [bp setClip]; + [bp release]; #ifdef NS_IMPL_GNUSTEP uRect = NSMakeRect (0, 0, 0, 0); @@ -3336,8 +3336,7 @@ ns_send_appdefined (int value) } static int -ns_read_socket (struct terminal *terminal, int expected, - struct input_event *hold_quit) +ns_read_socket (struct terminal *terminal, struct input_event *hold_quit) /* -------------------------------------------------------------------------- External (hook): Post an event to ourself and keep reading events until we read it back again. In effect process all events which were waiting. @@ -3355,16 +3354,12 @@ ns_read_socket (struct terminal *terminal, int expected, if (interrupt_input_blocked) { interrupt_input_pending = 1; -#ifdef SYNC_INPUT pending_signals = 1; -#endif return -1; } interrupt_input_pending = 0; -#ifdef SYNC_INPUT pending_signals = pending_atimers; -#endif BLOCK_INPUT; n_emacs_events_pending = 0; @@ -3726,7 +3721,7 @@ ns_judge_scroll_bars (struct frame *f) removed = YES; } - if (removed) + if (removed) [eview updateFrameSize: NO]; } @@ -3977,33 +3972,34 @@ ns_term_init (Lisp_Object display_name) static int ns_initialized = 0; Lisp_Object tmp; + if (ns_initialized) return x_display_list; + ns_initialized = 1; + NSTRACE (ns_term_init); + [outerpool release]; + outerpool = [[NSAutoreleasePool alloc] init]; + /* count object allocs (About, click icon); on OS X use ObjectAlloc tool */ /*GSDebugAllocationActive (YES); */ BLOCK_INPUT; - handling_signal = 0; - if (!ns_initialized) + baud_rate = 38400; + Fset_input_interrupt_mode (Qnil); + + if (selfds[0] == -1) { - baud_rate = 38400; - Fset_input_interrupt_mode (Qnil); - - if (selfds[0] == -1) + if (pipe (selfds) == -1) { - if (pipe (selfds) == -1) - { - fprintf (stderr, "Failed to create pipe: %s\n", - emacs_strerror (errno)); - emacs_abort (); - } - - fcntl (selfds[0], F_SETFL, O_NONBLOCK|fcntl (selfds[0], F_GETFL)); - FD_ZERO (&select_readfds); - FD_ZERO (&select_writefds); - pthread_mutex_init (&select_mutex, NULL); + fprintf (stderr, "Failed to create pipe: %s\n", + emacs_strerror (errno)); + emacs_abort (); } - ns_initialized = 1; + + fcntl (selfds[0], F_SETFL, O_NONBLOCK|fcntl (selfds[0], F_GETFL)); + FD_ZERO (&select_readfds); + FD_ZERO (&select_writefds); + pthread_mutex_init (&select_mutex, NULL); } ns_pending_files = [[NSMutableArray alloc] init]; @@ -4194,6 +4190,20 @@ ns_term_init (Lisp_Object display_name) } #endif /* MAC OS X menu setup */ + /* Register our external input/output types, used for determining + applicable services and also drag/drop eligibility. */ + ns_send_types = [[NSArray arrayWithObjects: NSStringPboardType, nil] retain]; + ns_return_types = [[NSArray arrayWithObjects: NSStringPboardType, nil] + retain]; + ns_drag_types = [[NSArray arrayWithObjects: + NSStringPboardType, + NSTabularTextPboardType, + NSFilenamesPboardType, + NSURLPboardType, + NSColorPboardType, + NSFontPboardType, nil] retain]; + + [NSApp run]; ns_do_open_file = YES; return dpyinfo; @@ -6223,7 +6233,7 @@ not_in_argv (NSString *arg) NSRect r = [super constrainFrameRect:frameRect toScreen:screen]; return r; } - + if (f->output_data.ns->dont_constrain || ns_menu_bar_should_be_hidden ()) return frameRect; diff --git a/src/termhooks.h b/src/termhooks.h index a1164be85cc..e5a59cfaf79 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -595,23 +595,14 @@ struct terminal TERMINAL indicates which terminal device to read from. Input events should be read into BUF, the size of which is given in - SIZE. EXPECTED is non-zero if the caller suspects that new input - is available. + SIZE. A positive return value indicates that that many input events - where read into BUF. + were read into BUF. Zero means no events were immediately available. A value of -1 means a transient read error, while -2 indicates - that the device was closed (hangup), and it should be deleted. - - XXX Please note that a non-zero value of EXPECTED only means that - there is available input on at least one of the currently opened - terminal devices -- but not necessarily on this device. - Therefore, in most cases EXPECTED should be simply ignored. - - XXX This documentation needs to be updated. */ + that the device was closed (hangup), and it should be deleted. */ int (*read_socket_hook) (struct terminal *terminal, - int expected, struct input_event *hold_quit); /* Called when a frame's display becomes entirely up to date. */ diff --git a/src/w32gui.h b/src/w32gui.h index 1ea185bfaa1..0da8de97f23 100644 --- a/src/w32gui.h +++ b/src/w32gui.h @@ -118,9 +118,6 @@ extern int nCmdShow; #define PBaseSize (1L << 8) /* program specified base for incrementing */ #define PWinGravity (1L << 9) /* program specified window gravity */ -extern int XParseGeometry (char *, int *, int *, unsigned *, unsigned *); - - typedef struct { int x, y; unsigned width, height; diff --git a/src/w32inevt.c b/src/w32inevt.c index d4cc620335c..a96d8d70483 100644 --- a/src/w32inevt.c +++ b/src/w32inevt.c @@ -744,7 +744,6 @@ maybe_generate_resize_event (void) int w32_console_read_socket (struct terminal *terminal, - int expected, struct input_event *hold_quit) { int nev, add; diff --git a/src/w32inevt.h b/src/w32inevt.h index c874e58ef39..319688b877b 100644 --- a/src/w32inevt.h +++ b/src/w32inevt.h @@ -21,7 +21,7 @@ along with GNU Emacs. If not, see . */ extern int w32_console_unicode_input; -extern int w32_console_read_socket (struct terminal *term, int numchars, +extern int w32_console_read_socket (struct terminal *term, struct input_event *hold_quit); extern void w32_console_mouse_position (FRAME_PTR *f, int insist, Lisp_Object *bar_window, diff --git a/src/w32term.c b/src/w32term.c index 6244728b264..b8227c52fed 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -4137,8 +4137,6 @@ static char dbcs_lead = 0; We return the number of characters stored into the buffer, thus pretending to be `read'. - EXPECTED is nonzero if the caller knows input is available. - Some of these messages are reposted back to the message queue since the system calls the windows proc directly in a context where we cannot return the data nor can we guarantee the state we are in. So if we dispatch them @@ -4149,7 +4147,7 @@ static char dbcs_lead = 0; */ static int -w32_read_socket (struct terminal *terminal, int expected, +w32_read_socket (struct terminal *terminal, struct input_event *hold_quit) { int count = 0; diff --git a/src/window.c b/src/window.c index 2589596ccfd..abdee7ec19b 100644 --- a/src/window.c +++ b/src/window.c @@ -3463,7 +3463,11 @@ make_window (void) wset_vertical_scroll_bar_type (w, Qt); wset_window_end_pos (w, make_number (0)); wset_window_end_vpos (w, make_number (0)); - + /* These Lisp fields are marked specially so they're not set to nil by + allocate_window. */ + wset_prev_buffers (w, Qnil); + wset_next_buffers (w, Qnil); + /* Initialize non-Lisp data. Note that allocate_window zeroes out all non-Lisp data, so do it only for slots which should not be zero. */ w->nrows_scale_factor = w->ncols_scale_factor = 1; diff --git a/src/window.h b/src/window.h index 62ae43a999d..115b361194c 100644 --- a/src/window.h +++ b/src/window.h @@ -220,13 +220,6 @@ struct window /* t means this window's child windows are not (re-)combined. */ Lisp_Object combination_limit; - /* Alist of triples listing - buffers previously shown in this window. */ - Lisp_Object prev_buffers; - - /* List of buffers re-shown in this window. */ - Lisp_Object next_buffers; - /* An alist with parameters. */ Lisp_Object window_parameters; @@ -238,6 +231,14 @@ struct window struct glyph_matrix *current_matrix; struct glyph_matrix *desired_matrix; + /* The two Lisp_Object fields below are marked in a special way, + which is why they're placed after `current_matrix'. */ + /* Alist of triples listing + buffers previously shown in this window. */ + Lisp_Object prev_buffers; + /* List of buffers re-shown in this window. */ + Lisp_Object next_buffers; + /* Number saying how recently window was selected. */ int use_time; diff --git a/src/xterm.c b/src/xterm.c index 5bc87d0ec64..a47056a6f94 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -7118,19 +7118,15 @@ x_dispatch_event (XEvent *event, Display *display) /* Read events coming from the X server. - This routine is called by the SIGIO handler only if SYNC_INPUT is - not defined. - We return as soon as there are no more events to be read. + Return as soon as there are no more events to be read. - We return the number of characters stored into the buffer, + Return the number of characters stored into the buffer, thus pretending to be `read' (except the characters we store in the keyboard buffer can be multibyte, so are not necessarily - C chars). - - EXPECTED is nonzero if the caller knows input is available. */ + C chars). */ static int -XTread_socket (struct terminal *terminal, int expected, struct input_event *hold_quit) +XTread_socket (struct terminal *terminal, struct input_event *hold_quit) { int count = 0; int event_found = 0;