aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoakim Verona2015-01-21 00:26:56 +0100
committerJoakim Verona2015-01-21 00:26:56 +0100
commit8628a48fec7fcd8bdbbf6ce5808fc574631d1541 (patch)
tree3dfc3b71850123e7514ddb149a0ba768618cfddf /src
parentffd9ee1d6412a6e61383930562e6167a458f0d5f (diff)
parent0dd19ac82662c5710e73852f438fd55e1d9225b7 (diff)
downloademacs-8628a48fec7fcd8bdbbf6ce5808fc574631d1541.tar.gz
emacs-8628a48fec7fcd8bdbbf6ce5808fc574631d1541.zip
Merge branch 'master' into xwidget
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog54
-rw-r--r--src/alloc.c4
-rw-r--r--src/coding.c4
-rw-r--r--src/dispnew.c16
-rw-r--r--src/gtkutil.c2
-rw-r--r--src/lisp.h8
-rw-r--r--src/minibuf.c2
-rw-r--r--src/nsfont.m2
-rw-r--r--src/nsterm.m5
-rw-r--r--src/w32fns.c2
-rw-r--r--src/xdisp.c39
-rw-r--r--src/xfns.c6
12 files changed, 93 insertions, 51 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f6a5f3837a3..e5e4fe9edb0 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,57 @@
12015-01-20 Paul Eggert <eggert@cs.ucla.edu>
2
3 Undo port to hypothetical nonzero Qnil case
4 This mostly undoes the previous change in this area. See:
5 http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00570.html
6 * alloc.c (allocate_pseudovector):
7 * callint.c (Fcall_interactively):
8 * dispnew.c (realloc_glyph_pool):
9 * fringe.c (init_fringe):
10 * lisp.h (memsetnil):
11 * xdisp.c (init_iterator):
12 Simplify by assuming that Qnil is zero, but verify the assumption.
13 * lisp.h (NIL_IS_ZERO): Revert back to this symbol, removing
14 NIL_IS_NONZERO. All uses changed.
15
162015-01-20 Jan Djärv <jan.h.d@swipnet.se>
17
18 * nsterm.m (EV_TRAILER2): Set Vinhibit_quit to Qt (Bug#19531).
19
202015-01-20 Dmitry Antipov <dmantipov@yandex.ru>
21
22 Prefer xlispstrdup to avoid dumb calls to strlen.
23 * nsfont.m (ns_get_family):
24 * nsterm.m (ns_term_init):
25 * w32fns.c (w32_window):
26 * xfns.c (x_window, Fx_select_font): Use xlispstrdup.
27
282015-01-20 Paul Eggert <eggert@cs.ucla.edu>
29
30 Correct an old fix for GTK font selection
31 * gtkutil.c (xg_get_font): Fix off-by-2 typo.
32 Fixes: bug#3228
33
34 Fix minor bugs with printing null bytes
35 * minibuf.c (read_minibuf_noninteractive):
36 * xdisp.c (Ftrace_to_stderr) [GLYPH_DEBUG]:
37 Work even if the Lisp string contains a null byte.
38
39 Port to hypothetical case where Qnil is nonzero
40 * alloc.c (allocate_pseudovector):
41 * callint.c (Fcall_interactively):
42 * coding.c (syms_of_coding):
43 * dispnew.c (realloc_glyph_pool):
44 * fringe.c (init_fringe):
45 * lisp.h (memsetnil):
46 * xdisp.c (init_iterator):
47 Port to the currently-hypothetical case where Qnil is nonzero.
48 * dispnew.c (adjust_glyph_matrix): Remove unnecessary verification,
49 as there are no Lisp_Object values in the data here.
50 * lisp.h (NIL_IS_NONZERO): New symbol, replacing NIL_IS_ZERO.
51 All uses changed. Define only if not already defined, so that one
52 can debug with -DNIL_IS_NONZERO.
53 * xdisp.c (init_iterator): Remove unnecessary initializations to 0.
54
12015-01-19 Eli Zaretskii <eliz@gnu.org> 552015-01-19 Eli Zaretskii <eliz@gnu.org>
2 56
3 * dispnew.c (adjust_glyph_matrix, realloc_glyph_pool): Verify that 57 * dispnew.c (adjust_glyph_matrix, realloc_glyph_pool): Verify that
diff --git a/src/alloc.c b/src/alloc.c
index 2c7b02f1158..bf0456c6862 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3175,9 +3175,9 @@ allocate_pseudovector (int memlen, int lisplen,
3175 eassert (lisplen <= (1 << PSEUDOVECTOR_SIZE_BITS) - 1); 3175 eassert (lisplen <= (1 << PSEUDOVECTOR_SIZE_BITS) - 1);
3176 3176
3177 /* 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.
3178 But since Qnil == 0, we can memset Lisp_Object slots as well. */ 3178 Since Qnil == 0, we can memset Lisp and non-Lisp data at one go. */
3179 verify (NIL_IS_ZERO); 3179 verify (NIL_IS_ZERO);
3180 memset (v->contents, 0, zerolen * word_size); 3180 memsetnil (v->contents, zerolen);
3181 3181
3182 XSETPVECTYPESIZE (v, tag, lisplen, memlen - lisplen); 3182 XSETPVECTYPESIZE (v, tag, lisplen, memlen - lisplen);
3183 return v; 3183 return v;
diff --git a/src/coding.c b/src/coding.c
index 77cea77cef5..b95c0a5f825 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -11272,8 +11272,8 @@ internal character representation. */);
11272 Vtranslation_table_for_input = Qnil; 11272 Vtranslation_table_for_input = Qnil;
11273 11273
11274 { 11274 {
11275 verify (NIL_IS_ZERO); 11275 Lisp_Object args[coding_arg_undecided_max];
11276 Lisp_Object args[coding_arg_undecided_max] = { LISP_INITIALLY_ZERO, }; 11276 memsetnil (args, ARRAYELTS (args));
11277 11277
11278 Lisp_Object plist[16]; 11278 Lisp_Object plist[16];
11279 plist[0] = intern_c_string (":name"); 11279 plist[0] = intern_c_string (":name");
diff --git a/src/dispnew.c b/src/dispnew.c
index abfdde6ef24..3c0f110446b 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -417,12 +417,6 @@ 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);
426 memset (matrix->rows + old_alloc, 0, 420 memset (matrix->rows + old_alloc, 0,
427 (matrix->rows_allocated - old_alloc) * sizeof *matrix->rows); 421 (matrix->rows_allocated - old_alloc) * sizeof *matrix->rows);
428 } 422 }
@@ -1349,12 +1343,12 @@ realloc_glyph_pool (struct glyph_pool *pool, struct dim matrix_dim)
1349 ptrdiff_t old_nglyphs = pool->nglyphs; 1343 ptrdiff_t old_nglyphs = pool->nglyphs;
1350 pool->glyphs = xpalloc (pool->glyphs, &pool->nglyphs, 1344 pool->glyphs = xpalloc (pool->glyphs, &pool->nglyphs,
1351 needed - old_nglyphs, -1, sizeof *pool->glyphs); 1345 needed - old_nglyphs, -1, sizeof *pool->glyphs);
1352 /* As a side effect, this sets the object of each glyph to nil, 1346
1353 so verify we will indeed get that. Redisplay relies on the 1347 /* Redisplay relies on nil as the object of special glyphs
1354 object of special glyphs (truncation and continuation glyps 1348 (truncation and continuation glyphs and also blanks used to
1355 and also blanks used to extend each line on a TTY) to be 1349 extend each line on a TTY), so verify that memset does this. */
1356 nil. */
1357 verify (NIL_IS_ZERO); 1350 verify (NIL_IS_ZERO);
1351
1358 memset (pool->glyphs + old_nglyphs, 0, 1352 memset (pool->glyphs + old_nglyphs, 0,
1359 (pool->nglyphs - old_nglyphs) * sizeof *pool->glyphs); 1353 (pool->nglyphs - old_nglyphs) * sizeof *pool->glyphs);
1360 } 1354 }
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 694278a2b4c..da05742b0c6 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -2093,7 +2093,7 @@ xg_get_font (struct frame *f, const char *default_name)
2093 args[8] = QCtype; 2093 args[8] = QCtype;
2094 args[9] = Qxft; 2094 args[9] = Qxft;
2095 2095
2096 font = Ffont_spec (8, args); 2096 font = Ffont_spec (10, args);
2097 2097
2098 pango_font_description_free (desc); 2098 pango_font_description_free (desc);
2099 dupstring (&x_last_font_name, name); 2099 dupstring (&x_last_font_name, name);
diff --git a/src/lisp.h b/src/lisp.h
index 65e6c626527..f1e6945f43a 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1513,13 +1513,13 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val)
1513 to find such assumptions later if we change Qnil to be nonzero. */ 1513 to find such assumptions later if we change Qnil to be nonzero. */
1514enum { NIL_IS_ZERO = XLI_BUILTIN_LISPSYM (iQnil) == 0 }; 1514enum { NIL_IS_ZERO = XLI_BUILTIN_LISPSYM (iQnil) == 0 };
1515 1515
1516/* Set a Lisp_Object array V's SIZE entries to nil. */ 1516/* Set a Lisp_Object array V's N entries to nil. */
1517INLINE void 1517INLINE void
1518memsetnil (Lisp_Object *v, ptrdiff_t size) 1518memsetnil (Lisp_Object *v, ptrdiff_t n)
1519{ 1519{
1520 eassert (0 <= size); 1520 eassert (0 <= n);
1521 verify (NIL_IS_ZERO); 1521 verify (NIL_IS_ZERO);
1522 memset (v, 0, size * sizeof *v); 1522 memset (v, 0, n * sizeof *v);
1523} 1523}
1524 1524
1525/* 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
diff --git a/src/minibuf.c b/src/minibuf.c
index 07f489258e1..0d6e2c79813 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -217,7 +217,7 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial,
217 suppress_echo_on_tty (fileno (stdin)); 217 suppress_echo_on_tty (fileno (stdin));
218 } 218 }
219 219
220 fprintf (stdout, "%s", SDATA (prompt)); 220 fwrite (SDATA (prompt), 1, SBYTES (prompt), stdout);
221 fflush (stdout); 221 fflush (stdout);
222 222
223 val = Qnil; 223 val = Qnil;
diff --git a/src/nsfont.m b/src/nsfont.m
index f5e89d32bfc..683ab178836 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -93,7 +93,7 @@ ns_get_family (Lisp_Object font_spec)
93 return nil; 93 return nil;
94 else 94 else
95 { 95 {
96 char *tmp = xstrdup (SSDATA (SYMBOL_NAME (tem))); 96 char *tmp = xlispstrdup (SYMBOL_NAME (tem));
97 NSString *family; 97 NSString *family;
98 ns_unescape_name (tmp); 98 ns_unescape_name (tmp);
99 family = [NSString stringWithUTF8String: tmp]; 99 family = [NSString stringWithUTF8String: tmp];
diff --git a/src/nsterm.m b/src/nsterm.m
index bf3192bf432..ee1268ef850 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -373,8 +373,11 @@ static CGPoint menu_mouse_point;
373 if (e) emacs_event->timestamp = EV_TIMESTAMP (e); \ 373 if (e) emacs_event->timestamp = EV_TIMESTAMP (e); \
374 if (q_event_ptr) \ 374 if (q_event_ptr) \
375 { \ 375 { \
376 Lisp_Object tem = Vinhibit_quit; \
377 Vinhibit_quit = Qt; \
376 n_emacs_events_pending++; \ 378 n_emacs_events_pending++; \
377 kbd_buffer_store_event_hold (emacs_event, q_event_ptr); \ 379 kbd_buffer_store_event_hold (emacs_event, q_event_ptr); \
380 Vinhibit_quit = tem; \
378 } \ 381 } \
379 else \ 382 else \
380 hold_event (emacs_event); \ 383 hold_event (emacs_event); \
@@ -4313,7 +4316,7 @@ ns_term_init (Lisp_Object display_name)
4313 4316
4314 dpyinfo->name_list_element = Fcons (display_name, Qnil); 4317 dpyinfo->name_list_element = Fcons (display_name, Qnil);
4315 4318
4316 terminal->name = xstrdup (SSDATA (display_name)); 4319 terminal->name = xlispstrdup (display_name);
4317 4320
4318 unblock_input (); 4321 unblock_input ();
4319 4322
diff --git a/src/w32fns.c b/src/w32fns.c
index 2dd92ff8a3a..55e58294629 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -4208,7 +4208,7 @@ w32_window (struct frame *f, long window_prompting, int minibuffer_only)
4208 for the window manager, so GC relocation won't bother it. 4208 for the window manager, so GC relocation won't bother it.
4209 4209
4210 Elsewhere we specify the window name for the window manager. */ 4210 Elsewhere we specify the window name for the window manager. */
4211 f->namebuf = xstrdup (SSDATA (Vx_resource_name)); 4211 f->namebuf = xlispstrdup (Vx_resource_name);
4212 4212
4213 my_create_window (f); 4213 my_create_window (f);
4214 4214
diff --git a/src/xdisp.c b/src/xdisp.c
index 208c1243e35..f6795415bcb 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2753,19 +2753,17 @@ 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 2756
2757 indeed get that. */ 2757 /* The code assumes it->object and other Lisp_Object components are
2758 set to nil, so verify that memset does this. */
2758 verify (NIL_IS_ZERO); 2759 verify (NIL_IS_ZERO);
2759 memset (it, 0, sizeof *it); 2760 memset (it, 0, sizeof *it);
2761
2760 it->current.overlay_string_index = -1; 2762 it->current.overlay_string_index = -1;
2761 it->current.dpvec_index = -1; 2763 it->current.dpvec_index = -1;
2762 it->base_face_id = remapped_base_face_id; 2764 it->base_face_id = remapped_base_face_id;
2763 it->string = Qnil;
2764 IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = -1; 2765 IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = -1;
2765 it->paragraph_embedding = L2R; 2766 it->paragraph_embedding = L2R;
2766 it->bidi_it.string.lstring = Qnil;
2767 it->bidi_it.string.s = NULL;
2768 it->bidi_it.string.bufpos = 0;
2769 it->bidi_it.w = w; 2767 it->bidi_it.w = w;
2770 2768
2771 /* The window in which we iterate over current_buffer: */ 2769 /* The window in which we iterate over current_buffer: */
@@ -2786,7 +2784,6 @@ init_iterator (struct it *it, struct window *w,
2786 * FRAME_LINE_HEIGHT (it->f)); 2784 * FRAME_LINE_HEIGHT (it->f));
2787 else if (it->f->extra_line_spacing > 0) 2785 else if (it->f->extra_line_spacing > 0)
2788 it->extra_line_spacing = it->f->extra_line_spacing; 2786 it->extra_line_spacing = it->f->extra_line_spacing;
2789 it->max_extra_line_spacing = 0;
2790 } 2787 }
2791 2788
2792 /* If realized faces have been removed, e.g. because of face 2789 /* If realized faces have been removed, e.g. because of face
@@ -2798,10 +2795,6 @@ init_iterator (struct it *it, struct window *w,
2798 if (FRAME_FACE_CACHE (it->f)->used == 0) 2795 if (FRAME_FACE_CACHE (it->f)->used == 0)
2799 recompute_basic_faces (it->f); 2796 recompute_basic_faces (it->f);
2800 2797
2801 /* Current value of the `slice', `space-width', and 'height' properties. */
2802 it->slice.x = it->slice.y = it->slice.width = it->slice.height = Qnil;
2803 it->space_width = Qnil;
2804 it->font_height = Qnil;
2805 it->override_ascent = -1; 2798 it->override_ascent = -1;
2806 2799
2807 /* Are control characters displayed as `^C'? */ 2800 /* Are control characters displayed as `^C'? */
@@ -2839,21 +2832,19 @@ init_iterator (struct it *it, struct window *w,
2839 it->tab_width = SANE_TAB_WIDTH (current_buffer); 2832 it->tab_width = SANE_TAB_WIDTH (current_buffer);
2840 2833
2841 /* Are lines in the display truncated? */ 2834 /* Are lines in the display truncated? */
2842 if (base_face_id != DEFAULT_FACE_ID 2835 if (TRUNCATE != 0)
2843 || it->w->hscroll
2844 || (! WINDOW_FULL_WIDTH_P (it->w)
2845 && ((!NILP (Vtruncate_partial_width_windows)
2846 && !INTEGERP (Vtruncate_partial_width_windows))
2847 || (INTEGERP (Vtruncate_partial_width_windows)
2848 /* PXW: Shall we do something about this? */
2849 && (WINDOW_TOTAL_COLS (it->w)
2850 < XINT (Vtruncate_partial_width_windows))))))
2851 it->line_wrap = TRUNCATE; 2836 it->line_wrap = TRUNCATE;
2852 else if (NILP (BVAR (current_buffer, truncate_lines))) 2837 if (base_face_id == DEFAULT_FACE_ID
2838 && !it->w->hscroll
2839 && (WINDOW_FULL_WIDTH_P (it->w)
2840 || NILP (Vtruncate_partial_width_windows)
2841 || (INTEGERP (Vtruncate_partial_width_windows)
2842 /* PXW: Shall we do something about this? */
2843 && (XINT (Vtruncate_partial_width_windows)
2844 <= WINDOW_TOTAL_COLS (it->w))))
2845 && NILP (BVAR (current_buffer, truncate_lines)))
2853 it->line_wrap = NILP (BVAR (current_buffer, word_wrap)) 2846 it->line_wrap = NILP (BVAR (current_buffer, word_wrap))
2854 ? WINDOW_WRAP : WORD_WRAP; 2847 ? WINDOW_WRAP : WORD_WRAP;
2855 else
2856 it->line_wrap = TRUNCATE;
2857 2848
2858 /* Get dimensions of truncation and continuation glyphs. These are 2849 /* Get dimensions of truncation and continuation glyphs. These are
2859 displayed as fringe bitmaps under X, but we need them for such 2850 displayed as fringe bitmaps under X, but we need them for such
@@ -18905,7 +18896,7 @@ usage: (trace-to-stderr STRING &rest OBJECTS) */)
18905 (ptrdiff_t nargs, Lisp_Object *args) 18896 (ptrdiff_t nargs, Lisp_Object *args)
18906{ 18897{
18907 Lisp_Object s = Fformat (nargs, args); 18898 Lisp_Object s = Fformat (nargs, args);
18908 fprintf (stderr, "%s", SDATA (s)); 18899 fwrite (SDATA (s), 1, SBYTES (s), stderr);
18909 return Qnil; 18900 return Qnil;
18910} 18901}
18911 18902
diff --git a/src/xfns.c b/src/xfns.c
index 936c769a2de..a09e4a6df63 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2238,7 +2238,7 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
2238 for the window manager, so GC relocation won't bother it. 2238 for the window manager, so GC relocation won't bother it.
2239 2239
2240 Elsewhere we specify the window name for the window manager. */ 2240 Elsewhere we specify the window name for the window manager. */
2241 f->namebuf = xstrdup (SSDATA (Vx_resource_name)); 2241 f->namebuf = xlispstrdup (Vx_resource_name);
2242 2242
2243 ac = 0; 2243 ac = 0;
2244 XtSetArg (al[ac], XtNallowShellResize, 1); ac++; 2244 XtSetArg (al[ac], XtNallowShellResize, 1); ac++;
@@ -5995,12 +5995,12 @@ nil, it defaults to the selected frame. */)
5995 XSETFONT (font, FRAME_FONT (f)); 5995 XSETFONT (font, FRAME_FONT (f));
5996 font_param = Ffont_get (font, intern (":name")); 5996 font_param = Ffont_get (font, intern (":name"));
5997 if (STRINGP (font_param)) 5997 if (STRINGP (font_param))
5998 default_name = xstrdup (SSDATA (font_param)); 5998 default_name = xlispstrdup (font_param);
5999 else 5999 else
6000 { 6000 {
6001 font_param = Fframe_parameter (frame, Qfont_param); 6001 font_param = Fframe_parameter (frame, Qfont_param);
6002 if (STRINGP (font_param)) 6002 if (STRINGP (font_param))
6003 default_name = xstrdup (SSDATA (font_param)); 6003 default_name = xlispstrdup (font_param);
6004 } 6004 }
6005 6005
6006 font = xg_get_font (f, default_name); 6006 font = xg_get_font (f, default_name);