diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 36 | ||||
| -rw-r--r-- | src/alloc.c | 6 | ||||
| -rw-r--r-- | src/callint.c | 10 | ||||
| -rw-r--r-- | src/coding.c | 9 | ||||
| -rw-r--r-- | src/dispnew.c | 12 | ||||
| -rw-r--r-- | src/eval.c | 11 | ||||
| -rw-r--r-- | src/fileio.c | 17 | ||||
| -rw-r--r-- | src/fns.c | 13 | ||||
| -rw-r--r-- | src/font.c | 7 | ||||
| -rw-r--r-- | src/fringe.c | 7 | ||||
| -rw-r--r-- | src/lisp.h | 24 | ||||
| -rw-r--r-- | src/xdisp.c | 3 |
12 files changed, 104 insertions, 51 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 16e2fa19626..f6a5f3837a3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,39 @@ | |||
| 1 | 2015-01-19 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * dispnew.c (adjust_glyph_matrix, realloc_glyph_pool): Verify that | ||
| 4 | Qnil is represented as zero, before using that to initialize parts | ||
| 5 | of the glyph structure. | ||
| 6 | |||
| 7 | * xdisp.c (init_iterator): Verify that Qnil is represented as | ||
| 8 | zero, before using that to initialize parts of the iterator | ||
| 9 | structure. | ||
| 10 | |||
| 11 | 2015-01-19 Paul Eggert <eggert@cs.ucla.edu> | ||
| 12 | |||
| 13 | Prefer memset to repeatedly assigning Qnil | ||
| 14 | * alloc.c (allocate_pseudovector): Catch more bogus values. | ||
| 15 | * alloc.c (allocate_pseudovector): | ||
| 16 | * callint.c (Fcall_interactively): | ||
| 17 | * coding.c (syms_of_coding): | ||
| 18 | * fringe.c (init_fringe): | ||
| 19 | Verify that Qnil == 0. | ||
| 20 | * callint.c (Fcall_interactively): | ||
| 21 | * eval.c (Fapply, Ffuncall): | ||
| 22 | * fns.c (mapcar1, larger_vector): | ||
| 23 | * font.c (font_expand_wildcards): | ||
| 24 | * fringe.c (init_fringe): | ||
| 25 | Prefer memset to assigning zeros by hand. | ||
| 26 | * callint.c (Fcall_interactively): | ||
| 27 | Remove duplicate assignment of Qnil to args[i]. | ||
| 28 | * coding.c (syms_of_coding): | ||
| 29 | Prefer LISP_INITIALLY_ZERO to assigning zeros by hand. | ||
| 30 | * fileio.c (Ffile_selinux_context): | ||
| 31 | Rewrite to avoid need for Lisp_Object array. | ||
| 32 | * lisp.h (XLI_BUILTIN_LISPSYM): New macro. | ||
| 33 | (DEFINE_LISP_SYMBOL_END): Use it. | ||
| 34 | (NIL_IS_ZERO): New constant. | ||
| 35 | (memsetnil): New function. | ||
| 36 | |||
| 1 | 2015-01-16 Dmitry Antipov <dmantipov@yandex.ru> | 37 | 2015-01-16 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 38 | ||
| 3 | Tune pseudovector allocation assuming Qnil == 0. | 39 | Tune pseudovector allocation assuming Qnil == 0. |
diff --git a/src/alloc.c b/src/alloc.c index 22a15b4ac59..2c7b02f1158 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -3169,12 +3169,14 @@ allocate_pseudovector (int memlen, int lisplen, | |||
| 3169 | struct Lisp_Vector *v = allocate_vectorlike (memlen); | 3169 | struct Lisp_Vector *v = allocate_vectorlike (memlen); |
| 3170 | 3170 | ||
| 3171 | /* Catch bogus values. */ | 3171 | /* Catch bogus values. */ |
| 3172 | eassert (tag <= PVEC_FONT); | 3172 | eassert (0 <= tag && tag <= PVEC_FONT); |
| 3173 | eassert (0 <= lisplen && lisplen <= zerolen && zerolen <= memlen); | ||
| 3173 | eassert (memlen - lisplen <= (1 << PSEUDOVECTOR_REST_BITS) - 1); | 3174 | eassert (memlen - lisplen <= (1 << PSEUDOVECTOR_REST_BITS) - 1); |
| 3174 | eassert (lisplen <= (1 << PSEUDOVECTOR_SIZE_BITS) - 1); | 3175 | eassert (lisplen <= (1 << PSEUDOVECTOR_SIZE_BITS) - 1); |
| 3175 | 3176 | ||
| 3176 | /* Only the first lisplen slots will be traced normally by the GC. | 3177 | /* Only the first LISPLEN slots will be traced normally by the GC. |
| 3177 | But since Qnil == 0, we can memset Lisp_Object slots as well. */ | 3178 | But since Qnil == 0, we can memset Lisp_Object slots as well. */ |
| 3179 | verify (NIL_IS_ZERO); | ||
| 3178 | memset (v->contents, 0, zerolen * word_size); | 3180 | memset (v->contents, 0, zerolen * word_size); |
| 3179 | 3181 | ||
| 3180 | XSETPVECTYPESIZE (v, tag, lisplen, memlen - lisplen); | 3182 | XSETPVECTYPESIZE (v, tag, lisplen, memlen - lisplen); |
diff --git a/src/callint.c b/src/callint.c index dd238b976aa..3a595b57d77 100644 --- a/src/callint.c +++ b/src/callint.c | |||
| @@ -509,12 +509,8 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 509 | visargs = args + nargs; | 509 | visargs = args + nargs; |
| 510 | varies = (signed char *) (visargs + nargs); | 510 | varies = (signed char *) (visargs + nargs); |
| 511 | 511 | ||
| 512 | for (i = 0; i < nargs; i++) | 512 | verify (NIL_IS_ZERO); |
| 513 | { | 513 | memset (args, 0, nargs * (2 * word_size + 1)); |
| 514 | args[i] = Qnil; | ||
| 515 | visargs[i] = Qnil; | ||
| 516 | varies[i] = 0; | ||
| 517 | } | ||
| 518 | 514 | ||
| 519 | GCPRO5 (prefix_arg, function, *args, *visargs, up_event); | 515 | GCPRO5 (prefix_arg, function, *args, *visargs, up_event); |
| 520 | gcpro3.nvars = nargs; | 516 | gcpro3.nvars = nargs; |
| @@ -781,7 +777,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 781 | argument if no prefix. */ | 777 | argument if no prefix. */ |
| 782 | if (NILP (prefix_arg)) | 778 | if (NILP (prefix_arg)) |
| 783 | { | 779 | { |
| 784 | args[i] = Qnil; | 780 | /* args[i] = Qnil; */ |
| 785 | varies[i] = -1; | 781 | varies[i] = -1; |
| 786 | } | 782 | } |
| 787 | else | 783 | else |
diff --git a/src/coding.c b/src/coding.c index b11143a32fb..77cea77cef5 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -11272,13 +11272,10 @@ internal character representation. */); | |||
| 11272 | Vtranslation_table_for_input = Qnil; | 11272 | Vtranslation_table_for_input = Qnil; |
| 11273 | 11273 | ||
| 11274 | { | 11274 | { |
| 11275 | Lisp_Object args[coding_arg_undecided_max]; | 11275 | verify (NIL_IS_ZERO); |
| 11276 | Lisp_Object plist[16]; | 11276 | Lisp_Object args[coding_arg_undecided_max] = { LISP_INITIALLY_ZERO, }; |
| 11277 | int i; | ||
| 11278 | |||
| 11279 | for (i = 0; i < coding_arg_undecided_max; i++) | ||
| 11280 | args[i] = Qnil; | ||
| 11281 | 11277 | ||
| 11278 | Lisp_Object plist[16]; | ||
| 11282 | plist[0] = intern_c_string (":name"); | 11279 | plist[0] = intern_c_string (":name"); |
| 11283 | plist[1] = args[coding_arg_name] = Qno_conversion; | 11280 | plist[1] = args[coding_arg_name] = Qno_conversion; |
| 11284 | plist[2] = intern_c_string (":mnemonic"); | 11281 | plist[2] = intern_c_string (":mnemonic"); |
diff --git a/src/dispnew.c b/src/dispnew.c index bfa06bd2878..abfdde6ef24 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -417,6 +417,12 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y | |||
| 417 | new_rows = dim.height - matrix->rows_allocated; | 417 | new_rows = dim.height - matrix->rows_allocated; |
| 418 | matrix->rows = xpalloc (matrix->rows, &matrix->rows_allocated, | 418 | matrix->rows = xpalloc (matrix->rows, &matrix->rows_allocated, |
| 419 | new_rows, INT_MAX, sizeof *matrix->rows); | 419 | new_rows, INT_MAX, sizeof *matrix->rows); |
| 420 | /* As a side effect, this sets the object of each glyph in the | ||
| 421 | row to nil, so verify we will indeed get that. Redisplay | ||
| 422 | relies on the object of special glyphs (truncation and | ||
| 423 | continuation glyps and also blanks used to extend each line | ||
| 424 | on a TTY) to be nil. */ | ||
| 425 | verify (NIL_IS_ZERO); | ||
| 420 | memset (matrix->rows + old_alloc, 0, | 426 | memset (matrix->rows + old_alloc, 0, |
| 421 | (matrix->rows_allocated - old_alloc) * sizeof *matrix->rows); | 427 | (matrix->rows_allocated - old_alloc) * sizeof *matrix->rows); |
| 422 | } | 428 | } |
| @@ -1343,6 +1349,12 @@ realloc_glyph_pool (struct glyph_pool *pool, struct dim matrix_dim) | |||
| 1343 | ptrdiff_t old_nglyphs = pool->nglyphs; | 1349 | ptrdiff_t old_nglyphs = pool->nglyphs; |
| 1344 | pool->glyphs = xpalloc (pool->glyphs, &pool->nglyphs, | 1350 | pool->glyphs = xpalloc (pool->glyphs, &pool->nglyphs, |
| 1345 | needed - old_nglyphs, -1, sizeof *pool->glyphs); | 1351 | needed - old_nglyphs, -1, sizeof *pool->glyphs); |
| 1352 | /* As a side effect, this sets the object of each glyph to nil, | ||
| 1353 | so verify we will indeed get that. Redisplay relies on the | ||
| 1354 | object of special glyphs (truncation and continuation glyps | ||
| 1355 | and also blanks used to extend each line on a TTY) to be | ||
| 1356 | nil. */ | ||
| 1357 | verify (NIL_IS_ZERO); | ||
| 1346 | memset (pool->glyphs + old_nglyphs, 0, | 1358 | memset (pool->glyphs + old_nglyphs, 0, |
| 1347 | (pool->nglyphs - old_nglyphs) * sizeof *pool->glyphs); | 1359 | (pool->nglyphs - old_nglyphs) * sizeof *pool->glyphs); |
| 1348 | } | 1360 | } |
diff --git a/src/eval.c b/src/eval.c index 5cadb1bc2de..ddf6535cabc 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -2299,8 +2299,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */) | |||
| 2299 | /* Avoid making funcall cons up a yet another new vector of arguments | 2299 | /* Avoid making funcall cons up a yet another new vector of arguments |
| 2300 | by explicitly supplying nil's for optional values. */ | 2300 | by explicitly supplying nil's for optional values. */ |
| 2301 | SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args); | 2301 | SAFE_ALLOCA_LISP (funcall_args, 1 + XSUBR (fun)->max_args); |
| 2302 | for (i = numargs; i < XSUBR (fun)->max_args; /* nothing */) | 2302 | memsetnil (funcall_args + numargs + 1, XSUBR (fun)->max_args - numargs); |
| 2303 | funcall_args[++i] = Qnil; | ||
| 2304 | funcall_nargs = 1 + XSUBR (fun)->max_args; | 2303 | funcall_nargs = 1 + XSUBR (fun)->max_args; |
| 2305 | } | 2304 | } |
| 2306 | else | 2305 | else |
| @@ -2638,8 +2637,8 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) | |||
| 2638 | ptrdiff_t numargs = nargs - 1; | 2637 | ptrdiff_t numargs = nargs - 1; |
| 2639 | Lisp_Object lisp_numargs; | 2638 | Lisp_Object lisp_numargs; |
| 2640 | Lisp_Object val; | 2639 | Lisp_Object val; |
| 2641 | register Lisp_Object *internal_args; | 2640 | Lisp_Object *internal_args; |
| 2642 | ptrdiff_t i, count; | 2641 | ptrdiff_t count; |
| 2643 | 2642 | ||
| 2644 | QUIT; | 2643 | QUIT; |
| 2645 | 2644 | ||
| @@ -2694,8 +2693,8 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) | |||
| 2694 | eassert (XSUBR (fun)->max_args <= ARRAYELTS (internal_argbuf)); | 2693 | eassert (XSUBR (fun)->max_args <= ARRAYELTS (internal_argbuf)); |
| 2695 | internal_args = internal_argbuf; | 2694 | internal_args = internal_argbuf; |
| 2696 | memcpy (internal_args, args + 1, numargs * word_size); | 2695 | memcpy (internal_args, args + 1, numargs * word_size); |
| 2697 | for (i = numargs; i < XSUBR (fun)->max_args; i++) | 2696 | memsetnil (internal_args + numargs, |
| 2698 | internal_args[i] = Qnil; | 2697 | XSUBR (fun)->max_args - numargs); |
| 2699 | } | 2698 | } |
| 2700 | else | 2699 | else |
| 2701 | internal_args = args + 1; | 2700 | internal_args = args + 1; |
diff --git a/src/fileio.c b/src/fileio.c index dc67a00ed2a..ff6720d4ae2 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -2812,7 +2812,8 @@ or if SELinux is disabled, or if Emacs lacks SELinux support. */) | |||
| 2812 | (Lisp_Object filename) | 2812 | (Lisp_Object filename) |
| 2813 | { | 2813 | { |
| 2814 | Lisp_Object absname; | 2814 | Lisp_Object absname; |
| 2815 | Lisp_Object values[4]; | 2815 | Lisp_Object user = Qnil, role = Qnil, type = Qnil, range = Qnil; |
| 2816 | |||
| 2816 | Lisp_Object handler; | 2817 | Lisp_Object handler; |
| 2817 | #if HAVE_LIBSELINUX | 2818 | #if HAVE_LIBSELINUX |
| 2818 | security_context_t con; | 2819 | security_context_t con; |
| @@ -2830,10 +2831,6 @@ or if SELinux is disabled, or if Emacs lacks SELinux support. */) | |||
| 2830 | 2831 | ||
| 2831 | absname = ENCODE_FILE (absname); | 2832 | absname = ENCODE_FILE (absname); |
| 2832 | 2833 | ||
| 2833 | values[0] = Qnil; | ||
| 2834 | values[1] = Qnil; | ||
| 2835 | values[2] = Qnil; | ||
| 2836 | values[3] = Qnil; | ||
| 2837 | #if HAVE_LIBSELINUX | 2834 | #if HAVE_LIBSELINUX |
| 2838 | if (is_selinux_enabled ()) | 2835 | if (is_selinux_enabled ()) |
| 2839 | { | 2836 | { |
| @@ -2842,20 +2839,20 @@ or if SELinux is disabled, or if Emacs lacks SELinux support. */) | |||
| 2842 | { | 2839 | { |
| 2843 | context = context_new (con); | 2840 | context = context_new (con); |
| 2844 | if (context_user_get (context)) | 2841 | if (context_user_get (context)) |
| 2845 | values[0] = build_string (context_user_get (context)); | 2842 | user = build_string (context_user_get (context)); |
| 2846 | if (context_role_get (context)) | 2843 | if (context_role_get (context)) |
| 2847 | values[1] = build_string (context_role_get (context)); | 2844 | role = build_string (context_role_get (context)); |
| 2848 | if (context_type_get (context)) | 2845 | if (context_type_get (context)) |
| 2849 | values[2] = build_string (context_type_get (context)); | 2846 | type = build_string (context_type_get (context)); |
| 2850 | if (context_range_get (context)) | 2847 | if (context_range_get (context)) |
| 2851 | values[3] = build_string (context_range_get (context)); | 2848 | range = build_string (context_range_get (context)); |
| 2852 | context_free (context); | 2849 | context_free (context); |
| 2853 | freecon (con); | 2850 | freecon (con); |
| 2854 | } | 2851 | } |
| 2855 | } | 2852 | } |
| 2856 | #endif | 2853 | #endif |
| 2857 | 2854 | ||
| 2858 | return Flist (ARRAYELTS (values), values); | 2855 | return list4 (user, role, type, range); |
| 2859 | } | 2856 | } |
| 2860 | 2857 | ||
| 2861 | DEFUN ("set-file-selinux-context", Fset_file_selinux_context, | 2858 | DEFUN ("set-file-selinux-context", Fset_file_selinux_context, |
| @@ -2517,16 +2517,14 @@ usage: (nconc &rest LISTS) */) | |||
| 2517 | static void | 2517 | static void |
| 2518 | mapcar1 (EMACS_INT leni, Lisp_Object *vals, Lisp_Object fn, Lisp_Object seq) | 2518 | mapcar1 (EMACS_INT leni, Lisp_Object *vals, Lisp_Object fn, Lisp_Object seq) |
| 2519 | { | 2519 | { |
| 2520 | register Lisp_Object tail; | 2520 | Lisp_Object tail, dummy; |
| 2521 | Lisp_Object dummy; | 2521 | EMACS_INT i; |
| 2522 | register EMACS_INT i; | ||
| 2523 | struct gcpro gcpro1, gcpro2, gcpro3; | 2522 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 2524 | 2523 | ||
| 2525 | if (vals) | 2524 | if (vals) |
| 2526 | { | 2525 | { |
| 2527 | /* Don't let vals contain any garbage when GC happens. */ | 2526 | /* Don't let vals contain any garbage when GC happens. */ |
| 2528 | for (i = 0; i < leni; i++) | 2527 | memsetnil (vals, leni); |
| 2529 | vals[i] = Qnil; | ||
| 2530 | 2528 | ||
| 2531 | GCPRO3 (dummy, fn, seq); | 2529 | GCPRO3 (dummy, fn, seq); |
| 2532 | gcpro1.var = vals; | 2530 | gcpro1.var = vals; |
| @@ -3688,7 +3686,7 @@ Lisp_Object | |||
| 3688 | larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t nitems_max) | 3686 | larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t nitems_max) |
| 3689 | { | 3687 | { |
| 3690 | struct Lisp_Vector *v; | 3688 | struct Lisp_Vector *v; |
| 3691 | ptrdiff_t i, incr, incr_max, old_size, new_size; | 3689 | ptrdiff_t incr, incr_max, old_size, new_size; |
| 3692 | ptrdiff_t C_language_max = min (PTRDIFF_MAX, SIZE_MAX) / sizeof *v->contents; | 3690 | ptrdiff_t C_language_max = min (PTRDIFF_MAX, SIZE_MAX) / sizeof *v->contents; |
| 3693 | ptrdiff_t n_max = (0 <= nitems_max && nitems_max < C_language_max | 3691 | ptrdiff_t n_max = (0 <= nitems_max && nitems_max < C_language_max |
| 3694 | ? nitems_max : C_language_max); | 3692 | ? nitems_max : C_language_max); |
| @@ -3702,8 +3700,7 @@ larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t nitems_max) | |||
| 3702 | new_size = old_size + incr; | 3700 | new_size = old_size + incr; |
| 3703 | v = allocate_vector (new_size); | 3701 | v = allocate_vector (new_size); |
| 3704 | memcpy (v->contents, XVECTOR (vec)->contents, old_size * sizeof *v->contents); | 3702 | memcpy (v->contents, XVECTOR (vec)->contents, old_size * sizeof *v->contents); |
| 3705 | for (i = old_size; i < new_size; ++i) | 3703 | memsetnil (v->contents + old_size, new_size - old_size); |
| 3706 | v->contents[i] = Qnil; | ||
| 3707 | XSETVECTOR (vec, v); | 3704 | XSETVECTOR (vec, v); |
| 3708 | return vec; | 3705 | return vec; |
| 3709 | } | 3706 | } |
diff --git a/src/font.c b/src/font.c index 56a27821718..190b33a8ef0 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -989,15 +989,14 @@ font_expand_wildcards (Lisp_Object *field, int n) | |||
| 989 | if (i == 0 || ! NILP (tmp[i - 1])) | 989 | if (i == 0 || ! NILP (tmp[i - 1])) |
| 990 | /* None of TMP[X] corresponds to Jth field. */ | 990 | /* None of TMP[X] corresponds to Jth field. */ |
| 991 | return -1; | 991 | return -1; |
| 992 | for (; j < range[i].from; j++) | 992 | memsetnil (field + j, range[i].from - j); |
| 993 | field[j] = Qnil; | 993 | j = range[i].from; |
| 994 | } | 994 | } |
| 995 | field[j++] = tmp[i]; | 995 | field[j++] = tmp[i]; |
| 996 | } | 996 | } |
| 997 | if (! NILP (tmp[n - 1]) && j < XLFD_REGISTRY_INDEX) | 997 | if (! NILP (tmp[n - 1]) && j < XLFD_REGISTRY_INDEX) |
| 998 | return -1; | 998 | return -1; |
| 999 | for (; j < XLFD_LAST_INDEX; j++) | 999 | memsetnil (field + j, XLFD_LAST_INDEX - j); |
| 1000 | field[j] = Qnil; | ||
| 1001 | if (INTEGERP (field[XLFD_ENCODING_INDEX])) | 1000 | if (INTEGERP (field[XLFD_ENCODING_INDEX])) |
| 1002 | field[XLFD_ENCODING_INDEX] | 1001 | field[XLFD_ENCODING_INDEX] |
| 1003 | = Fintern (Fnumber_to_string (field[XLFD_ENCODING_INDEX]), Qnil); | 1002 | = Fintern (Fnumber_to_string (field[XLFD_ENCODING_INDEX]), Qnil); |
diff --git a/src/fringe.c b/src/fringe.c index c7262d19336..464379d0cd0 100644 --- a/src/fringe.c +++ b/src/fringe.c | |||
| @@ -1723,15 +1723,12 @@ init_fringe_once (void) | |||
| 1723 | void | 1723 | void |
| 1724 | init_fringe (void) | 1724 | init_fringe (void) |
| 1725 | { | 1725 | { |
| 1726 | int i; | ||
| 1727 | |||
| 1728 | max_fringe_bitmaps = MAX_STANDARD_FRINGE_BITMAPS + 20; | 1726 | max_fringe_bitmaps = MAX_STANDARD_FRINGE_BITMAPS + 20; |
| 1729 | 1727 | ||
| 1730 | fringe_bitmaps = xzalloc (max_fringe_bitmaps * sizeof *fringe_bitmaps); | 1728 | fringe_bitmaps = xzalloc (max_fringe_bitmaps * sizeof *fringe_bitmaps); |
| 1731 | fringe_faces = xmalloc (max_fringe_bitmaps * sizeof *fringe_faces); | ||
| 1732 | 1729 | ||
| 1733 | for (i = 0; i < max_fringe_bitmaps; i++) | 1730 | verify (NIL_IS_ZERO); |
| 1734 | fringe_faces[i] = Qnil; | 1731 | fringe_faces = xzalloc (max_fringe_bitmaps * sizeof *fringe_faces); |
| 1735 | } | 1732 | } |
| 1736 | 1733 | ||
| 1737 | #ifdef HAVE_NTGUI | 1734 | #ifdef HAVE_NTGUI |
diff --git a/src/lisp.h b/src/lisp.h index e94e39a5d01..65e6c626527 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -732,14 +732,18 @@ struct Lisp_Symbol | |||
| 732 | TAG_PTR (Lisp_Symbol, \ | 732 | TAG_PTR (Lisp_Symbol, \ |
| 733 | ((uintptr_t) (offset) >> (USE_LSB_TAG ? 0 : GCTYPEBITS))) | 733 | ((uintptr_t) (offset) >> (USE_LSB_TAG ? 0 : GCTYPEBITS))) |
| 734 | 734 | ||
| 735 | /* XLI_BUILTIN_LISPSYM (iQwhatever) is equivalent to | ||
| 736 | XLI (builtin_lisp_symbol (Qwhatever)), | ||
| 737 | except the former expands to an integer constant expression. */ | ||
| 738 | #define XLI_BUILTIN_LISPSYM(iname) TAG_SYMOFFSET ((iname) * sizeof *lispsym) | ||
| 739 | |||
| 735 | /* Declare extern constants for Lisp symbols. These can be helpful | 740 | /* Declare extern constants for Lisp symbols. These can be helpful |
| 736 | when using a debugger like GDB, on older platforms where the debug | 741 | when using a debugger like GDB, on older platforms where the debug |
| 737 | format does not represent C macros. */ | 742 | format does not represent C macros. */ |
| 738 | #define DEFINE_LISP_SYMBOL_BEGIN(name) \ | 743 | #define DEFINE_LISP_SYMBOL_BEGIN(name) \ |
| 739 | DEFINE_GDB_SYMBOL_BEGIN (Lisp_Object, name) | 744 | DEFINE_GDB_SYMBOL_BEGIN (Lisp_Object, name) |
| 740 | #define DEFINE_LISP_SYMBOL_END(name) \ | 745 | #define DEFINE_LISP_SYMBOL_END(name) \ |
| 741 | DEFINE_GDB_SYMBOL_END (LISP_INITIALLY (TAG_SYMOFFSET (i##name \ | 746 | DEFINE_GDB_SYMBOL_END (LISP_INITIALLY (XLI_BUILTIN_LISPSYM (i##name))) |
| 742 | * sizeof *lispsym))) | ||
| 743 | 747 | ||
| 744 | #include "globals.h" | 748 | #include "globals.h" |
| 745 | 749 | ||
| @@ -1504,6 +1508,20 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val) | |||
| 1504 | XVECTOR (array)->contents[idx] = val; | 1508 | XVECTOR (array)->contents[idx] = val; |
| 1505 | } | 1509 | } |
| 1506 | 1510 | ||
| 1511 | /* True, since Qnil's representation is zero. Every place in the code | ||
| 1512 | that assumes Qnil is zero should verify (NIL_IS_ZERO), to make it easy | ||
| 1513 | to find such assumptions later if we change Qnil to be nonzero. */ | ||
| 1514 | enum { NIL_IS_ZERO = XLI_BUILTIN_LISPSYM (iQnil) == 0 }; | ||
| 1515 | |||
| 1516 | /* Set a Lisp_Object array V's SIZE entries to nil. */ | ||
| 1517 | INLINE void | ||
| 1518 | memsetnil (Lisp_Object *v, ptrdiff_t size) | ||
| 1519 | { | ||
| 1520 | eassert (0 <= size); | ||
| 1521 | verify (NIL_IS_ZERO); | ||
| 1522 | memset (v, 0, size * sizeof *v); | ||
| 1523 | } | ||
| 1524 | |||
| 1507 | /* If a struct is made to look like a vector, this macro returns the length | 1525 | /* If a struct is made to look like a vector, this macro returns the length |
| 1508 | of the shortest vector that would hold that struct. */ | 1526 | of the shortest vector that would hold that struct. */ |
| 1509 | 1527 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index fcc0809a464..208c1243e35 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -2753,6 +2753,9 @@ init_iterator (struct it *it, struct window *w, | |||
| 2753 | } | 2753 | } |
| 2754 | 2754 | ||
| 2755 | /* Clear IT. */ | 2755 | /* Clear IT. */ |
| 2756 | /* As a side effect, this sets it->object to nil, so verify we will | ||
| 2757 | indeed get that. */ | ||
| 2758 | verify (NIL_IS_ZERO); | ||
| 2756 | memset (it, 0, sizeof *it); | 2759 | memset (it, 0, sizeof *it); |
| 2757 | it->current.overlay_string_index = -1; | 2760 | it->current.overlay_string_index = -1; |
| 2758 | it->current.dpvec_index = -1; | 2761 | it->current.dpvec_index = -1; |