From 2dd2e62273983693076360e1bc4e59a0f9184c68 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 2 Dec 2012 15:11:42 -0800 Subject: Fix xpalloc confusion after memory is exhausted. * alloc.c (xpalloc): Comment fix. * charset.c (Fdefine_charset_internal): If xpalloc exhausts memory and signals an error, do not clear charset_table_size, as charset_table is still valid. * doprnt.c (evxprintf): Clear *BUF after freeing it. --- src/alloc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index 28c9b51dab4..e504b3d93ec 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -761,13 +761,17 @@ xnrealloc (void *pa, ptrdiff_t nitems, ptrdiff_t item_size) infinity. If PA is null, then allocate a new array instead of reallocating - the old one. Thus, to grow an array A without saving its old - contents, invoke xfree (A) immediately followed by xgrowalloc (0, - &NITEMS, ...). + the old one. Block interrupt input as needed. If memory exhaustion occurs, set *NITEMS to zero if PA is null, and signal an error (i.e., do not - return). */ + return). + + Thus, to grow an array A without saving its old contents, do + { xfree (A); A = NULL; A = xpalloc (NULL, &AITEMS, ...); }. + The A = NULL avoids a dangling pointer if xpalloc exhausts memory + and signals an error, and later this code is reexecuted and + attempts to free A. */ void * xpalloc (void *pa, ptrdiff_t *nitems, ptrdiff_t nitems_incr_min, -- cgit v1.2.1 From 62c2e5ed3a9c991cef2594b44afc74893f6ce26b Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Mon, 3 Dec 2012 12:06:02 +0400 Subject: * alloc.c (free_save_value): New function. (safe_alloca_unwind): Use it. * lisp.h (free_save_value): New prototype. * editfns.c (save_excursion_save): Use Lisp_Misc_Save_Value. Add comment. (save_excursion_restore): Adjust to match saved data structure. Use free_save_value to offload some work from GC. Drop obsolete #if 0 code. --- src/alloc.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index e504b3d93ec..0f105f87207 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -826,12 +826,7 @@ xstrdup (const char *s) Lisp_Object safe_alloca_unwind (Lisp_Object arg) { - register struct Lisp_Save_Value *p = XSAVE_VALUE (arg); - - p->dogc = 0; - xfree (p->pointer); - p->pointer = 0; - free_misc (arg); + free_save_value (arg); return Qnil; } @@ -3365,6 +3360,19 @@ make_save_value (void *pointer, ptrdiff_t integer) return val; } +/* Free a Lisp_Misc_Save_Value object. */ + +void +free_save_value (Lisp_Object save) +{ + register struct Lisp_Save_Value *p = XSAVE_VALUE (save); + + p->dogc = 0; + xfree (p->pointer); + p->pointer = NULL; + free_misc (save); +} + /* Return a Lisp_Misc_Overlay object with specified START, END and PLIST. */ Lisp_Object -- cgit v1.2.1 From 5745a7df2b4abe06d032820f6ec7ddbac9ad5028 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 8 Dec 2012 09:19:51 -0800 Subject: Use putenv+unsetenv instead of modifying environ directly. * admin/merge-gnulib (GNULIB_MODULES): Add putenv, unsetenv. * lib/putenv.c, lib/unsetenv.c, m4/putenv.m4, m4/setenv.m4: New files, copied automatically from gnulib. * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. * src/alloc.c (xputenv): New function. * src/dbusbind.c (Fdbus_init_bus): * src/emacs.c (main): * src/xterm.c (x_term_init): Use xputenv instead of setenv or putenv, to detect memory exhaustion. * src/editfns.c (initial_tz): Move static var decl up. (tzvalbuf_in_environ): New static var. (init_editfns): Initialize these two static vars. (Fencode_time): Don't assume arbitrary limit on EMACS_INT width. Save old TZ value on stack, if it's small. (Fencode_time, set_time_zone_rule): Don't modify 'environ' directly; instead, use xputenv+unsetenv to set and restore TZ. (environbuf): Remove static var. All uses removed. (Fset_time_zone_rule): Do not save TZ and environ; no longer needed here. (set_time_zone_rule_tz1, set_time_zone_rule_tz2) [LOCALTIME_CACHE]: Move to inside set_time_zone_rule; they don't need file scope any more. (set_time_zone_rule): Maintain the TZ=value string separately. (syms_of_editfns): Don't initialize initial_tz; init_editfns now does it. * src/emacs.c (dump_tz) [HAVE_TZSET]: Now const. * src/lisp.h (xputenv): New decl. Fixes: debbugs:13070 --- src/alloc.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index 0f105f87207..5a3ba465d81 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -820,6 +820,15 @@ xstrdup (const char *s) return p; } +/* Like putenv, but (1) use the equivalent of xmalloc and (2) the + argument is a const pointer. */ + +void +xputenv (char const *string) +{ + if (putenv ((char *) string) != 0) + memory_full (0); +} /* Unwind for SAFE_ALLOCA */ -- cgit v1.2.1 From 6cda572a0f7da777cea9680131aa79be3f9be999 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Wed, 26 Dec 2012 19:40:19 +0400 Subject: * print.c (print_object): If Lisp_Save_Value object's pointer is the address of a memory area containing Lisp_Objects, try to print them. * alloc.c (valid_lisp_object_p): Adjust comment. --- src/alloc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index 5a3ba465d81..f33c423ece7 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4721,12 +4721,12 @@ valid_pointer_p (void *p) #endif } -/* Return 2 if OBJ is a killed or special buffer object. - Return 1 if OBJ is a valid lisp object. - Return 0 if OBJ is NOT a valid lisp object. - Return -1 if we cannot validate OBJ. - This function can be quite slow, - so it should only be used in code for manual debugging. */ +/* Return 2 if OBJ is a killed or special buffer object, 1 if OBJ is a + valid lisp object, 0 if OBJ is NOT a valid lisp object, or -1 if we + cannot validate OBJ. This function can be quite slow, so its primary + use is the manual debugging. The only exception is print_object, where + we use it to check whether the memory referenced by the pointer of + Lisp_Save_Value object contains valid objects. */ int valid_lisp_object_p (Lisp_Object obj) -- cgit v1.2.1 From ab422c4d6899b1442cb6954c1829c1fb656b006c Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 1 Jan 2013 09:11:05 +0000 Subject: Update copyright notices for 2013. --- src/alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index 5bb528c64ab..9536a1d610f 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -1,7 +1,7 @@ /* Storage allocation and gc for GNU Emacs Lisp interpreter. -Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2012 - Free Software Foundation, Inc. +Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2013 Free Software +Foundation, Inc. This file is part of GNU Emacs. -- cgit v1.2.1 From fbc9ce11fa593f2fb87a8a0ea5f1b7a78bd13425 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 11 Jan 2013 17:47:07 -0800 Subject: Remove obsolete comment about NON_SAVING_SETJMP. --- src/alloc.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index 8dc3f11e80a..b147aa20723 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4446,11 +4446,6 @@ mark_memory (void *start, void *end) } } -/* setjmp will work with GCC unless NON_SAVING_SETJMP is defined in - the GCC system configuration. In gcc 3.2, the only systems for - which this is so are i386-sco5 non-ELF, i386-sysv3 (maybe included - by others?) and ns32k-pc532-min. */ - #if !defined GC_SAVE_REGISTERS_ON_STACK && !defined GC_SETJMP_WORKS static bool setjmp_tested_p; -- cgit v1.2.1 From 73ebd38f16c4799b657e501f188e9f3a3eca7805 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Mon, 14 Jan 2013 13:55:21 +0400 Subject: Make Lisp_Save_Value more versatile storage for up to four objects. * lisp.h (toplevel): Enumeration to describe types of saved objects. (struct Lisp_Save_Value): New layout. Adjust comments. (XSAVE_POINTER): New macro. (XSAVE_INTEGER): Likewise. (allocate_misc): Add prototype. (free_misc): Likewise. * alloc.c (allocate_misc): Now global. (free_misc): Likewise. Adjust comment. (make_save_value): Use new Lisp_Save_Value layout. Adjust comment. (free_save_value): Likewise. (mark_object): Likewise. * editfns.c (save_excursion_save): Pack everything within Lisp_Save_Value and so avoid xmalloc. (save_excursion_restore): Adjust to match new layout. Use free_misc because we do not allocate extra memory any more. Add eassert. * print.c (print_object): New code to print Lisp_Save_Value. Do not rely on valid_lisp_object_p if !GC_MARK_STACK. Adjust comments. * dired.c, fileio.c, font.c, ftfont.c, gtkutil.c, keymap.c, * lread.c, nsmenu.m, nsterm.h, xfns.c, xmenu.c, xselect.c: Use XSAVE_POINTER and XSAVE_INTEGER where appropriate. --- src/alloc.c | 59 ++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 36 insertions(+), 23 deletions(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index b147aa20723..c50bb0f32c7 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -219,7 +219,6 @@ static void refill_memory_reserve (void); #endif static void compact_small_strings (void); static void free_large_strings (void); -static void free_misc (Lisp_Object); extern Lisp_Object which_symbols (Lisp_Object, EMACS_INT) EXTERNALLY_VISIBLE; /* When scanning the C stack for live Lisp objects, Emacs keeps track of @@ -3303,7 +3302,7 @@ static union Lisp_Misc *marker_free_list; /* Return a newly allocated Lisp_Misc object of specified TYPE. */ -static Lisp_Object +Lisp_Object allocate_misc (enum Lisp_Misc_Type type) { Lisp_Object val; @@ -3339,9 +3338,9 @@ allocate_misc (enum Lisp_Misc_Type type) return val; } -/* Free a Lisp_Misc object */ +/* Free a Lisp_Misc object. */ -static void +void free_misc (Lisp_Object misc) { XMISCTYPE (misc) = Lisp_Misc_Free; @@ -3351,9 +3350,10 @@ free_misc (Lisp_Object misc) total_free_markers++; } -/* Return a Lisp_Misc_Save_Value object containing POINTER and - INTEGER. This is used to package C values to call record_unwind_protect. - The unwind function can get the C values back using XSAVE_VALUE. */ +/* Return a Lisp_Save_Value object containing POINTER and INTEGER. + Most code should use this to package C integers and pointers + to call record_unwind_protect. The unwind function can get the + C values back using XSAVE_POINTER and XSAVE_INTEGER. */ Lisp_Object make_save_value (void *pointer, ptrdiff_t integer) @@ -3363,22 +3363,22 @@ make_save_value (void *pointer, ptrdiff_t integer) val = allocate_misc (Lisp_Misc_Save_Value); p = XSAVE_VALUE (val); - p->pointer = pointer; - p->integer = integer; - p->dogc = 0; + p->type0 = SAVE_POINTER; + p->data[0].pointer = pointer; + p->type1 = SAVE_INTEGER; + p->data[1].integer = integer; + p->type2 = p->type3 = SAVE_UNUSED; + p->area = 0; return val; } -/* Free a Lisp_Misc_Save_Value object. */ +/* Free a Lisp_Save_Value object. Do not use this function + if SAVE contains pointer other than returned by xmalloc. */ void free_save_value (Lisp_Object save) { - register struct Lisp_Save_Value *p = XSAVE_VALUE (save); - - p->dogc = 0; - xfree (p->pointer); - p->pointer = NULL; + xfree (XSAVE_POINTER (save)); free_misc (save); } @@ -5935,20 +5935,33 @@ mark_object (Lisp_Object arg) case Lisp_Misc_Save_Value: XMISCANY (obj)->gcmarkbit = 1; -#if GC_MARK_STACK { register struct Lisp_Save_Value *ptr = XSAVE_VALUE (obj); - /* If DOGC is set, POINTER is the address of a memory - area containing INTEGER potential Lisp_Objects. */ - if (ptr->dogc) + /* If `area' is nonzero, `data[0].pointer' is the address + of a memory area containing `data[1].integer' potential + Lisp_Objects. */ +#if GC_MARK_STACK + if (ptr->area) { - Lisp_Object *p = (Lisp_Object *) ptr->pointer; + Lisp_Object *p = (Lisp_Object *) ptr->data[0].pointer; ptrdiff_t nelt; - for (nelt = ptr->integer; nelt > 0; nelt--, p++) + for (nelt = ptr->data[1].integer; nelt > 0; nelt--, p++) mark_maybe_object (*p); } + else +#endif /* GC_MARK_STACK */ + { + /* Find Lisp_Objects in `data[N]' slots and mark them. */ + if (ptr->type0 == SAVE_OBJECT) + mark_object (ptr->data[0].object); + if (ptr->type1 == SAVE_OBJECT) + mark_object (ptr->data[1].object); + if (ptr->type2 == SAVE_OBJECT) + mark_object (ptr->data[2].object); + if (ptr->type3 == SAVE_OBJECT) + mark_object (ptr->data[3].object); + } } -#endif break; case Lisp_Misc_Overlay: -- cgit v1.2.1 From c50cf2eac4b18e38bef5b6e58827cc2bce1e98f4 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 14 Jan 2013 09:46:14 -0800 Subject: Avoid needless casts with XSAVE_POINTER. * alloc.c (mark_object) [GC_MARK_STACK]: * dired.c (directory_files_internal_unwind): * fileio.c (do_auto_save_unwind): * gtkutil.c (pop_down_dialog): * keymap.c (map_keymap_char_table_item): * lread.c (load_unwind): * nsmenu.m (pop_down_menu): * print.c (print_object) [GC_MARK_STACK]: * xfns.c (clean_up_file_dialog): * xmenu.c (cleanup_widget_value_tree): Omit casts between XSAVE_POINTER and a pointer type. --- src/alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index c50bb0f32c7..3f1ccc82a58 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -5943,7 +5943,7 @@ mark_object (Lisp_Object arg) #if GC_MARK_STACK if (ptr->area) { - Lisp_Object *p = (Lisp_Object *) ptr->data[0].pointer; + Lisp_Object *p = ptr->data[0].pointer; ptrdiff_t nelt; for (nelt = ptr->data[1].integer; nelt > 0; nelt--, p++) mark_maybe_object (*p); -- cgit v1.2.1 From 1b971ac155006504b6b1c2688199747f976723af Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Tue, 15 Jan 2013 12:38:07 +0400 Subject: Some convenient bits to deal with Lisp_Save_Values. * lisp.h (XSAVE_OBJECT): New macro to extract saved objects. (allocate_misc): Remove prototype. (format_save_value): New prototype. * alloc.c (allocate_misc): Revert back to static. (format_save_value): New function to build Lisp_Save_Value object with the specified internal structure. (make_save_value): Reimplement using format_save_value. * editfns.c (save_excursion_save): Use format_save_value. (save_excursion_restore): Use XSAVE_OBJECT. --- src/alloc.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 55 insertions(+), 13 deletions(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index 3f1ccc82a58..e1cb97163ce 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -3302,7 +3302,7 @@ static union Lisp_Misc *marker_free_list; /* Return a newly allocated Lisp_Misc object of specified TYPE. */ -Lisp_Object +static Lisp_Object allocate_misc (enum Lisp_Misc_Type type) { Lisp_Object val; @@ -3350,6 +3350,59 @@ free_misc (Lisp_Object misc) total_free_markers++; } +/* Return a Lisp_Save_Value object with the data saved according to + FMT. Format specifiers are `i' for an integer, `p' for a pointer + and `o' for Lisp_Object. Up to 4 objects can be specified. */ + +Lisp_Object +format_save_value (const char *fmt, ...) +{ + va_list ap; + int len = strlen (fmt); + Lisp_Object val = allocate_misc (Lisp_Misc_Save_Value); + struct Lisp_Save_Value *p = XSAVE_VALUE (val); + + eassert (0 < len && len < 5); + va_start (ap, fmt); + +#define INITX(index) \ + do { \ + if (len <= index) \ + p->type ## index = SAVE_UNUSED; \ + else \ + { \ + if (fmt[index] == 'i') \ + { \ + p->type ## index = SAVE_INTEGER; \ + p->data[index].integer = va_arg (ap, ptrdiff_t); \ + } \ + else if (fmt[index] == 'p') \ + { \ + p->type ## index = SAVE_POINTER; \ + p->data[index].pointer = va_arg (ap, void *); \ + } \ + else if (fmt[index] == 'o') \ + { \ + p->type ## index = SAVE_OBJECT; \ + p->data[index].object = va_arg (ap, Lisp_Object); \ + } \ + else \ + emacs_abort (); \ + } \ + } while (0) + + INITX (0); + INITX (1); + INITX (2); + INITX (3); + +#undef INITX + + va_end (ap); + p->area = 0; + return val; +} + /* Return a Lisp_Save_Value object containing POINTER and INTEGER. Most code should use this to package C integers and pointers to call record_unwind_protect. The unwind function can get the @@ -3358,18 +3411,7 @@ free_misc (Lisp_Object misc) Lisp_Object make_save_value (void *pointer, ptrdiff_t integer) { - register Lisp_Object val; - register struct Lisp_Save_Value *p; - - val = allocate_misc (Lisp_Misc_Save_Value); - p = XSAVE_VALUE (val); - p->type0 = SAVE_POINTER; - p->data[0].pointer = pointer; - p->type1 = SAVE_INTEGER; - p->data[1].integer = integer; - p->type2 = p->type3 = SAVE_UNUSED; - p->area = 0; - return val; + return format_save_value ("pi", pointer, integer); } /* Free a Lisp_Save_Value object. Do not use this function -- cgit v1.2.1 From 2b30549c493d7b67fa92c2b4bcd2bd2e55210ae1 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Tue, 15 Jan 2013 13:22:25 +0400 Subject: * src/lisp.h (XSAVE_POINTER, XSAVE_INTEGER): Change to allow extraction from any Lisp_Save_Value slot. Add type checking. * src/alloc.c, src/dired.c, src/editfns.c, src/fileio.c, src/ftfont.c: * src/gtkutil.c, src/keymap.c, src/lread.c, src/nsterm.h, src/nsmenu.c: * src/xfns.c, src/xmenu.c, src/xselect.c: All users changed. * admin/coccinelle/xsave.cocci: Semantic patch to adjust users of XSAVE_POINTER and XSAVE_INTEGER macros. --- src/alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index e1cb97163ce..b83b621bc7d 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -3420,7 +3420,7 @@ make_save_value (void *pointer, ptrdiff_t integer) void free_save_value (Lisp_Object save) { - xfree (XSAVE_POINTER (save)); + xfree (XSAVE_POINTER (save, 0)); free_misc (save); } -- cgit v1.2.1 From 963ea40fe96634a01b24aef4fc39acf9a4236eb7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 15 Jan 2013 13:38:58 -0800 Subject: * src/alloc.c (free_save_value): Now static. --- src/alloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index b83b621bc7d..7275a01bb73 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -209,6 +209,7 @@ Lisp_Object Qchar_table_extra_slots; static Lisp_Object Qpost_gc_hook; +static void free_save_value (Lisp_Object); static void mark_terminals (void); static void gc_sweep (void); static Lisp_Object make_pure_vector (ptrdiff_t); @@ -3417,7 +3418,7 @@ make_save_value (void *pointer, ptrdiff_t integer) /* Free a Lisp_Save_Value object. Do not use this function if SAVE contains pointer other than returned by xmalloc. */ -void +static void free_save_value (Lisp_Object save) { xfree (XSAVE_POINTER (save, 0)); -- cgit v1.2.1 From 468afbaceaeb045f69b1a47aa1550a2556cd7dfd Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Thu, 17 Jan 2013 10:29:40 +0400 Subject: * lisp.h (toplevel): Add comment about using Lisp_Save_Value objects, related functions and macros. (make_save_value): Adjust prototype. (make_save_pointer): New prototype. (SAFE_NALLOCA): Fix indentation. Use make_save_pointer. (SAFE_ALLOCA_LISP): Adjust make_save_value usage. * alloc.c (format_save_value): Rename to make_save_value. (make_save_pointer): New function. (record_xmalloc): Use make_save_pointer. * dired.c, editfns.c, fileio.c, font.c, gtkutil.c, lread.c: * nsmenu.m, nsterm.m, xfns.c, xmenu.c, xselect.c, keymap.c: Change users of make_save_value to make_save_pointer. Likewise for format_save_value and make_save_value. --- src/alloc.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index 7275a01bb73..a2e7282bb60 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -845,7 +845,7 @@ void * record_xmalloc (size_t size) { void *p = xmalloc (size); - record_unwind_protect (safe_alloca_unwind, make_save_value (p, 0)); + record_unwind_protect (safe_alloca_unwind, make_save_pointer (p)); return p; } @@ -3356,7 +3356,7 @@ free_misc (Lisp_Object misc) and `o' for Lisp_Object. Up to 4 objects can be specified. */ Lisp_Object -format_save_value (const char *fmt, ...) +make_save_value (const char *fmt, ...) { va_list ap; int len = strlen (fmt); @@ -3404,15 +3404,19 @@ format_save_value (const char *fmt, ...) return val; } -/* Return a Lisp_Save_Value object containing POINTER and INTEGER. - Most code should use this to package C integers and pointers - to call record_unwind_protect. The unwind function can get the - C values back using XSAVE_POINTER and XSAVE_INTEGER. */ +/* The most common task it to save just one C pointer. */ Lisp_Object -make_save_value (void *pointer, ptrdiff_t integer) +make_save_pointer (void *pointer) { - return format_save_value ("pi", pointer, integer); + Lisp_Object val = allocate_misc (Lisp_Misc_Save_Value); + struct Lisp_Save_Value *p = XSAVE_VALUE (val); + + p->area = 0; + p->type0 = SAVE_POINTER; + p->data[0].pointer = pointer; + p->type1 = p->type2 = p->type3 = SAVE_UNUSED; + return val; } /* Free a Lisp_Save_Value object. Do not use this function -- cgit v1.2.1 From b09cca6ace3728ad8a93b3c0301520fa75e71586 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 23 Jan 2013 15:07:28 -0500 Subject: * src/xdisp.c (message2, message2_nolog): Remove functions. (message3, message3_nolog): Extract nbytes and multibyteness directly from the string. Change all callers. (message3_nolog): Don't set message_enable_multibyte since set_message will reset it anyway. (message1, message1_nolog): Use message3. (vmessage): Use a stack allocated buffer rather than f->message_buf. (with_echo_area_buffer): Remove last two arguments. Update all callers. (set_message): Drop all but the second arg, which has to be a string. (set_message_1): Simplify now that we know that a1 is NULL and the second arg is a string. * src/frame.h (struct frame): Remove `message_buf' field. Use glyphs_initialized_p instead. (FRAME_MESSAGE_BUF): Remove macro. * src/w16select.c (Fw16_set_clipboard_data): Prefer message3 to message2. * src/lisp.h (message2, message2_nolog): Remove declarations. (message3, message3_nolog): Update declarations. * src/keyboard.c (read_char_minibuf_menu_text) (read_char_minibuf_menu_width): Remove vars. (read_char_minibuf_menu_prompt): Rewrite the menu's construction so as to correctly handle multibyte strings. * src/frame.c (delete_frame): Don't free message_buf any more. * src/editfns.c (message_text, message_length): Remove vars. (Fmessage_box): Don't copy the Lisp string's bytes any longer. * src/fileio.c (auto_save_error): Use message3 instead of message2. * src/dispnew.c (adjust_frame_message_buffer): Remove function. --- src/alloc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index a2e7282bb60..2624650ed2c 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -26,7 +26,7 @@ along with GNU Emacs. If not, see . */ #include /* For CHAR_BIT. */ #ifdef ENABLE_CHECKING -#include /* For SIGABRT. */ +#include /* For SIGABRT. */ #endif #ifdef HAVE_PTHREAD @@ -1684,7 +1684,7 @@ allocate_string_data (struct Lisp_String *s, b = lisp_malloc (size + GC_STRING_EXTRA, MEM_TYPE_NON_LISP); #ifdef DOUG_LEA_MALLOC - /* Back to a reasonable maximum of mmap'ed areas. */ + /* Back to a reasonable maximum of mmap'ed areas. */ mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); #endif @@ -1901,7 +1901,7 @@ compact_small_strings (void) #ifdef GC_CHECK_STRING_BYTES /* Check that the string size recorded in the string is the - same as the one recorded in the sdata structure. */ + same as the one recorded in the sdata structure. */ if (s && string_bytes (s) != SDATA_NBYTES (from)) emacs_abort (); #endif /* GC_CHECK_STRING_BYTES */ @@ -6564,7 +6564,7 @@ die (const char *msg, const char *file, int line) } #endif -/* Initialization */ +/* Initialization. */ void init_alloc_once (void) @@ -6579,9 +6579,9 @@ init_alloc_once (void) #endif #ifdef DOUG_LEA_MALLOC - mallopt (M_TRIM_THRESHOLD, 128*1024); /* trim threshold */ - mallopt (M_MMAP_THRESHOLD, 64*1024); /* mmap threshold */ - mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); /* max. number of mmap'ed areas */ + mallopt (M_TRIM_THRESHOLD, 128 * 1024); /* Trim threshold. */ + mallopt (M_MMAP_THRESHOLD, 64 * 1024); /* Mmap threshold. */ + mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); /* Max. number of mmap'ed areas. */ #endif init_strings (); init_vectors (); -- cgit v1.2.1 From 25721f5bb5681c22f666a0b4e61d94687d92a671 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Fri, 8 Feb 2013 09:28:52 +0400 Subject: * lisp.h (make_uninit_vector): New function. * alloc.c (Fvector, Fmake_byte_code): * ccl.c (Fregister_ccl_program): * charset.c (Fdefine_charset_internal, define_charset_internal): * coding.c (make_subsidiaries, Fdefine_coding_system_internal): * composite.c (syms_of_composite): * font.c (Fquery_font, Ffont_info, syms_of_font): * fontset.c (FONT_DEF_NEW, Fset_fontset_font): * ftfont.c (ftfont_shape_by_flt): * indent.c (recompute_width_table): * nsselect.m (clean_local_selection_data): * syntax.c (init_syntax_once): * w32unsubscribe.c (uniscribe_shape): * window.c (Fcurrent_window_configuration): * xfaces.c (Fx_family_fonts): * xselect.c (selection_data_to_lisp_data): Use it. --- src/alloc.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index 2624650ed2c..80086433e65 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -3105,13 +3105,10 @@ Any number of arguments, even zero arguments, are allowed. usage: (vector &rest OBJECTS) */) (ptrdiff_t nargs, Lisp_Object *args) { - register Lisp_Object len, val; ptrdiff_t i; - register struct Lisp_Vector *p; + register Lisp_Object val = make_uninit_vector (nargs); + register struct Lisp_Vector *p = XVECTOR (val); - XSETFASTINT (len, nargs); - val = Fmake_vector (len, Qnil); - p = XVECTOR (val); for (i = 0; i < nargs; i++) p->contents[i] = args[i]; return val; @@ -3149,9 +3146,9 @@ stack before executing the byte-code. usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS) */) (ptrdiff_t nargs, Lisp_Object *args) { - register Lisp_Object len, val; ptrdiff_t i; - register struct Lisp_Vector *p; + register Lisp_Object val = make_uninit_vector (nargs); + register struct Lisp_Vector *p = XVECTOR (val); /* We used to purecopy everything here, if purify-flag was set. This worked OK for Emacs-23, but with Emacs-24's lexical binding code, it can be @@ -3161,10 +3158,6 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT just wasteful and other times plainly wrong (e.g. those free vars may want to be setcar'd). */ - XSETFASTINT (len, nargs); - val = Fmake_vector (len, Qnil); - - p = XVECTOR (val); for (i = 0; i < nargs; i++) p->contents[i] = args[i]; make_byte_code (p); -- cgit v1.2.1 From d9df6f40e326f3f5487b7c50b99bf5112262badc Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 13 Mar 2013 00:27:34 -0700 Subject: Static checking by Sun C 5.12. * lib-src/etags.c (analyse_regex): Omit unreachable code. * src/alloc.c (buffer_memory_full) [REL_ALLOC]: * src/bytecode.c (exec_byte_code): * src/dispnew.c (init_display): * src/eval.c (error): * src/fileio.c (Fsubstitute_in_file_name): * src/keyboard.c (Fevent_convert_list): * src/keymap.c (Fsingle_key_description): * src/term.c (maybe_fatal, fatal): * src/xfns.c (Fx_display_backing_store, Fx_display_visual_class): * src/xsmfns.c (Fhandle_save_session): Omit unreachable code. * src/keymap.c (map_keymap_char_table_item): Cast void * to a function pointer type; the C Standard requires this. --- src/alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index 80086433e65..b2703c5f961 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -422,11 +422,11 @@ buffer_memory_full (ptrdiff_t nbytes) #ifndef REL_ALLOC memory_full (nbytes); -#endif - +#else /* This used to call error, but if we've run out of memory, we could get infinite recursion trying to build the string. */ xsignal (Qnil, Vmemory_signal_data); +#endif } /* A common multiple of the positive integers A and B. Ideally this -- cgit v1.2.1 From bad98418bf75efc6dd8ac393157413bc6ef769b4 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 18 Mar 2013 21:41:53 -0700 Subject: Spelling fixes. --- src/alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index b2703c5f961..5e30c1b20ad 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -1162,7 +1162,7 @@ lisp_align_free (void *block) #define INTERVAL_BLOCK_SIZE \ ((1020 - sizeof (struct interval_block *)) / sizeof (struct interval)) -/* Intervals are allocated in chunks in form of an interval_block +/* Intervals are allocated in chunks in the form of an interval_block structure. */ struct interval_block -- cgit v1.2.1 From d6723bf7e58e17c889e354bc429f3f134281953a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 21 Mar 2013 11:28:50 -0700 Subject: * alloc.c: Remove redundant static declarations. --- src/alloc.c | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index 5e30c1b20ad..39379bc3bd7 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -323,20 +323,7 @@ static void *min_heap_address, *max_heap_address; static struct mem_node mem_z; #define MEM_NIL &mem_z -static struct Lisp_Vector *allocate_vectorlike (ptrdiff_t); -static void lisp_free (void *); -static void mark_stack (void); -static bool live_vector_p (struct mem_node *, void *); -static bool live_buffer_p (struct mem_node *, void *); -static bool live_string_p (struct mem_node *, void *); -static bool live_cons_p (struct mem_node *, void *); -static bool live_symbol_p (struct mem_node *, void *); -static bool live_float_p (struct mem_node *, void *); -static bool live_misc_p (struct mem_node *, void *); -static void mark_maybe_object (Lisp_Object); -static void mark_memory (void *, void *); #if GC_MARK_STACK || defined GC_MALLOC_CHECK -static void mem_init (void); static struct mem_node *mem_insert (void *, void *, enum mem_type); static void mem_insert_fixup (struct mem_node *); static void mem_rotate_left (struct mem_node *); @@ -346,11 +333,6 @@ static void mem_delete_fixup (struct mem_node *); static struct mem_node *mem_find (void *); #endif - -#if GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS -static void check_gcpros (void); -#endif - #endif /* GC_MARK_STACK || GC_MALLOC_CHECK */ #ifndef DEADP -- cgit v1.2.1 From 7b1123d824e51d40496c242e7a7f173de8936100 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Thu, 21 Mar 2013 13:56:22 -0700 Subject: Use functions and constants to manipulate Lisp_Save_Value objects. This replaces code that used macros and strings and token-pasting. The change makes the C source a bit easier to follow, and shrinks the Emacs executable a bit. * alloc.c: Verify some properties of Lisp_Save_Value's representation. (make_save_value): Change 1st arg from string to enum. All callers changed. (INTX): Remove. (mark_object): Use if, not #if, for GC_MARK_STACK. * lisp.h (SAVE_VALUEP, XSAVE_VALUE, XSAVE_POINTER, XSAVE_INTEGER) (XSAVE_OBJECT): Now functions, not macros. (STRING_BYTES_BOUND): Now just a macro, not a constant too; the constant was never used. (SAVE_SLOT_BITS, SAVE_VALUE_SLOTS, SAVE_TYPE_BITS, SAVE_TYPE_INT_INT) (SAVE_TYPE_INT_INT_INT, SAVE_TYPE_OBJ_OBJ, SAVE_TYPE_OBJ_OBJ_OBJ) (SAVE_TYPE_OBJ_OBJ_OBJ_OBJ, SAVE_TYPE_PTR_INT, SAVE_TYPE_PTR_OBJ) (SAVE_TYPE_PTR_PTR, SAVE_TYPE_PTR_PTR_OBJ, SAVE_TYPE_MEMORY): New constants. (struct Lisp_Save_Value): Replace members area, type0, type1, type2, type3 with a single member save_type. All uses changed. (save_type, set_save_pointer, set_save_integer): New functions. * print.c (PRINTX): Remove. --- src/alloc.c | 95 ++++++++++++++++++++++++++----------------------------------- 1 file changed, 40 insertions(+), 55 deletions(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index 39379bc3bd7..4245b3069fa 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -3326,56 +3326,50 @@ free_misc (Lisp_Object misc) total_free_markers++; } +/* Verify properties of Lisp_Save_Value's representation + that are assumed here and elsewhere. */ + +verify (SAVE_UNUSED == 0); +verify ((SAVE_INTEGER | SAVE_POINTER | SAVE_OBJECT) >> SAVE_SLOT_BITS == 0); + /* Return a Lisp_Save_Value object with the data saved according to - FMT. Format specifiers are `i' for an integer, `p' for a pointer - and `o' for Lisp_Object. Up to 4 objects can be specified. */ + DATA_TYPE. DATA_TYPE should be one of SAVE_TYPE_INT_INT, etc. */ Lisp_Object -make_save_value (const char *fmt, ...) +make_save_value (enum Lisp_Save_Type save_type, ...) { va_list ap; - int len = strlen (fmt); + int i; Lisp_Object val = allocate_misc (Lisp_Misc_Save_Value); struct Lisp_Save_Value *p = XSAVE_VALUE (val); - eassert (0 < len && len < 5); - va_start (ap, fmt); - -#define INITX(index) \ - do { \ - if (len <= index) \ - p->type ## index = SAVE_UNUSED; \ - else \ - { \ - if (fmt[index] == 'i') \ - { \ - p->type ## index = SAVE_INTEGER; \ - p->data[index].integer = va_arg (ap, ptrdiff_t); \ - } \ - else if (fmt[index] == 'p') \ - { \ - p->type ## index = SAVE_POINTER; \ - p->data[index].pointer = va_arg (ap, void *); \ - } \ - else if (fmt[index] == 'o') \ - { \ - p->type ## index = SAVE_OBJECT; \ - p->data[index].object = va_arg (ap, Lisp_Object); \ - } \ - else \ - emacs_abort (); \ - } \ - } while (0) + eassert (0 < save_type + && (save_type < 1 << (SAVE_TYPE_BITS - 1) + || save_type == SAVE_TYPE_MEMORY)); + p->save_type = save_type; + va_start (ap, save_type); + save_type &= ~ (1 << (SAVE_TYPE_BITS - 1)); + + for (i = 0; save_type; i++, save_type >>= SAVE_SLOT_BITS) + switch (save_type & ((1 << SAVE_SLOT_BITS) - 1)) + { + case SAVE_POINTER: + p->data[i].pointer = va_arg (ap, void *); + break; - INITX (0); - INITX (1); - INITX (2); - INITX (3); + case SAVE_INTEGER: + p->data[i].integer = va_arg (ap, ptrdiff_t); + break; -#undef INITX + case SAVE_OBJECT: + p->data[i].object = va_arg (ap, Lisp_Object); + break; + + default: + emacs_abort (); + } va_end (ap); - p->area = 0; return val; } @@ -3386,11 +3380,8 @@ make_save_pointer (void *pointer) { Lisp_Object val = allocate_misc (Lisp_Misc_Save_Value); struct Lisp_Save_Value *p = XSAVE_VALUE (val); - - p->area = 0; - p->type0 = SAVE_POINTER; + p->save_type = SAVE_POINTER; p->data[0].pointer = pointer; - p->type1 = p->type2 = p->type3 = SAVE_UNUSED; return val; } @@ -5958,12 +5949,11 @@ mark_object (Lisp_Object arg) case Lisp_Misc_Save_Value: XMISCANY (obj)->gcmarkbit = 1; { - register struct Lisp_Save_Value *ptr = XSAVE_VALUE (obj); - /* If `area' is nonzero, `data[0].pointer' is the address + struct Lisp_Save_Value *ptr = XSAVE_VALUE (obj); + /* If `save_type' is zero, `data[0].pointer' is the address of a memory area containing `data[1].integer' potential Lisp_Objects. */ -#if GC_MARK_STACK - if (ptr->area) + if (GC_MARK_STACK && ptr->save_type == SAVE_TYPE_MEMORY) { Lisp_Object *p = ptr->data[0].pointer; ptrdiff_t nelt; @@ -5971,17 +5961,12 @@ mark_object (Lisp_Object arg) mark_maybe_object (*p); } else -#endif /* GC_MARK_STACK */ { /* Find Lisp_Objects in `data[N]' slots and mark them. */ - if (ptr->type0 == SAVE_OBJECT) - mark_object (ptr->data[0].object); - if (ptr->type1 == SAVE_OBJECT) - mark_object (ptr->data[1].object); - if (ptr->type2 == SAVE_OBJECT) - mark_object (ptr->data[2].object); - if (ptr->type3 == SAVE_OBJECT) - mark_object (ptr->data[3].object); + int i; + for (i = 0; i < SAVE_VALUE_SLOTS; i++) + if (save_type (ptr, i) == SAVE_OBJECT) + mark_object (ptr->data[i].object); } } break; -- cgit v1.2.1 From 908589fd28437a9b0995b103e22ce5e4d421eb8a Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Sun, 24 Mar 2013 13:59:45 +0100 Subject: Reorder conditions that are written backwards * alloc.c (xpalloc, Fgarbage_collect): Reorder conditions that are written backwards. * blockinput.h (input_blocked_p): Likewise. * bytecode.c (exec_byte_code): Likewise. * callproc.c (call_process_kill, call_process_cleanup) (Fcall_process): Likewise. * ccl.c (ccl_driver, resolve_symbol_ccl_program) (Fccl_execute_on_string): Likewise. * character.c (string_escape_byte8): Likewise. * charset.c (read_hex): Likewise. * cm.c (calccost): Likewise. * data.c (cons_to_unsigned): Likewise. * dired.c (directory_files_internal, file_name_completion): Likewise. * dispnew.c (scrolling_window, update_frame_1, Fsleep_for) (sit_for): Likewise. * doc.c (Fsubstitute_command_keys): Likewise. * doprnt.c (doprnt): Likewise. * editfns.c (hi_time, decode_time_components, Fformat): Likewise. * emacsgtkfixed.c: Likewise. * fileio.c (file_offset, Fwrite_region): Likewise. * floatfns.c (Fexpt, fmod_float): Likewise. * fns.c (larger_vector, make_hash_table, Fmake_hash_table): Likewise. * font.c (font_intern_prop): Likewise. * frame.c (x_set_alpha): Likewise. * gtkutil.c (get_utf8_string): Likewise. * indent.c (check_display_width): Likewise. * intervals.c (create_root_interval, rotate_right, rotate_left) (split_interval_right, split_interval_left) (adjust_intervals_for_insertion, delete_node) (interval_deletion_adjustment, adjust_intervals_for_deletion) (merge_interval_right, merge_interval_left, copy_intervals) (set_intervals_multibyte_1): Likewise. * keyboard.c (gobble_input, append_tool_bar_item): Likewise. * keymap.c (Fkey_description): Likewise. * lisp.h (FIXNUM_OVERFLOW_P, vcopy): Likewise. * lread.c (openp, read_integer, read1, string_to_number): Likewise. * menu.c (ensure_menu_items): Likewise. * minibuf.c (read_minibuf_noninteractive): Likewise. * print.c (printchar, strout): Likewise. * process.c (create_process, Faccept_process_output) (wait_reading_process_output, read_process_output, send_process) (wait_reading_process_output): Likewise. * profiler.c (make_log, handle_profiler_signal): Likewise. * regex.c (re_exec): Likewise. * regex.h: Likewise. * search.c (looking_at_1, Freplace_match): Likewise. * sysdep.c (get_child_status, procfs_ttyname) (procfs_get_total_memory): Likewise. * systime.h (EMACS_TIME_VALID_P): Likewise. * term.c (dissociate_if_controlling_tty): Likewise. * window.c (get_phys_cursor_glyph): Likewise. * xdisp.c (init_iterator, redisplay_internal, redisplay_window) (try_window_reusing_current_matrix, try_window_id, pint2hrstr): Likewise. * xfns.c (Fx_window_property): Likewise. * xmenu.c (set_frame_menubar): Likewise. * xselect.c (x_get_window_property, x_handle_dnd_message): Likewise. * xsmfns.c (smc_save_yourself_CB): Likewise. * xterm.c (x_scroll_bar_set_handle): Likewise. --- src/alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index 4245b3069fa..ea833c62b94 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -779,7 +779,7 @@ xpalloc (void *pa, ptrdiff_t *nitems, ptrdiff_t nitems_incr_min, ptrdiff_t nitems_incr_max = n_max - n; ptrdiff_t incr = max (nitems_incr_min, min (incr_estimate, nitems_incr_max)); - eassert (0 < item_size && 0 < nitems_incr_min && 0 <= n && -1 <= nitems_max); + eassert (item_size > 0 && nitems_incr_min > 0 && n >= 0 && nitems_max >= -1); if (! pa) *nitems = 0; if (nitems_incr_max < incr) @@ -5376,7 +5376,7 @@ See Info node `(elisp)Garbage Collection'. */) double tot = total_bytes_of_live_objects (); tot *= XFLOAT_DATA (Vgc_cons_percentage); - if (0 < tot) + if (tot > 0) { if (tot < TYPE_MAXIMUM (EMACS_INT)) gc_relative_threshold = tot; -- cgit v1.2.1 From e74aeda863cd6896e06e92586f87b45d63d67d15 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Thu, 28 Mar 2013 18:04:49 +0400 Subject: * window.h (struct window): Replace hchild, vchild and buffer slots with the only contents slot. This is possible because each valid window may have either the child window (in vertical or horizontal combination) or buffer to display (for the leaf window). Using that, a lof of operations to traverse and/or change window hierarchies may be simplified. New member horizontal is used to distinguish between horizontal and vertical combinations of internal windows. (WINDOW_LEAF_P, WINDOW_HORIZONTAL_COMBINATION_P) (WINDOW_VERTICAL_COMBINATION_P): New macros. (WINDOW_VALID_P, WINDOW_LIVE_P): Adjust to match struct window changes. * window.c (wset_hchild, wset_vchild): Remove. Adjust all users. Use contents slot, not buffer, where appropriate. (wset_combination): New function. (wset_buffer): Add eassert. (Fframe_first_window): Simplify the loop reaching first window. (Fwindow_buffer): Use WINDOW_LEAF_P. (Fwindow_top_child): Use WINDOW_VERTICAL_COMBINATION_P. (Fwindow_left_child): Use WINDOW_HORIZONTAL_COMBINATION_P. (unshow_buffer): Convert initial debugging check to eassert. (replace_window, recombine_windows, Fdelete_other_windows_internal) (make_parent_window, window_resize_check, window_resize_apply) (resize_frame_windows, Fsplit_window_internal, Fdelete_window_internal) (Fset_window_configuration, delete_all_child_windows, save_window_save): Adjust to match struct window changes. (window_loop): Check for broken markers in CHECK_ALL_WINDOWS. (mark_window_cursors_off, count_windows, get_leaf_windows) (foreach_window_1): Simplify the loop. * alloc.c (mark_object): Do not check for the leaf window because internal windows has no glyph matrices anyway. * dispnew.c (clear_window_matrices, showing_window_margins_p) (allocate_matrices_for_window_redisplay, fake_current_matrices) (allocate_matrices_for_frame_redisplay, free_window_matrices) (build_frame_matrix_from_window_tree, mirror_make_current) (frame_row_to_window, mirror_line_dance, check_window_matrix_pointers) (update_window_tree, set_window_update_flags): Simplify the loop. (sync_window_with_frame_matrix_rows): Enforce live window. Use contents slot, not buffer, where appropriate. * frame.c (set_menu_bar_lines_1): Use WINDOW_VERTICAL_COMBINATION_P and WINDOW_HORIZONTAL_COMBINATION_P. (make_frame_visible_1): Simplify the loop. Use contents slot, not buffer, where appropriate. * xdisp.c (hscroll_window_tree, mark_window_display_accurate) (redisplay_windows, redisplay_mode_lines, update_cursor_in_window_tree) (expose_window_tree): Likewise. Use contents slot, not buffer, where appropriate. * textprop.c (get_char_property_and_overlay): Add CHECK_LIVE_WINDOW to avoid deleted windows. Use contents slot instead of buffer. * buffer.c, dispextern.h, editfns.c, fileio.c, font.c, fringe.c: * indent.c, insdel.c, keyboard.c, keymap.c, minibuf.c, msdos.c: * nsfns.m, nsmenu.m, nsterm.m, print.c, w32fns.c, w32menu.c, xfaces.c: * xfns.c, xmenu.c: Use contents slot, not buffer, where appropriate. --- src/alloc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/alloc.c') diff --git a/src/alloc.c b/src/alloc.c index ea833c62b94..0a7950273f6 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -5810,14 +5810,13 @@ mark_object (Lisp_Object arg) case PVEC_WINDOW: { struct window *w = (struct window *) ptr; - bool leaf = NILP (w->hchild) && NILP (w->vchild); mark_vectorlike (ptr); - /* Mark glyphs for leaf windows. Marking window + /* Mark glyph matrices, if any. Marking window matrices is sufficient because frame matrices use the same glyph memory. */ - if (leaf && w->current_matrix) + if (w->current_matrix) { mark_glyph_matrix (w->current_matrix); mark_glyph_matrix (w->desired_matrix); -- cgit v1.2.1