Fix the Windows build broken by 2013-08-13T15:29:25Z!dmantipov@yandex.ru.
authorEli Zaretskii <eliz@gnu.org>
Tue, 13 Aug 2013 18:01:18 +0000 (21:01 +0300)
committerEli Zaretskii <eliz@gnu.org>
Tue, 13 Aug 2013 18:01:18 +0000 (21:01 +0300)
 src/window.c (Fwindow_margins): Return nil when there's no marginal
 area, as per the documented API.
 src/w32term.c (x_scroll_bar_create): Use ALLOCATE_PSEUDOVECTOR, not
 Fmake_vector, as scroll bar's struct members are not all Lisp
 objects now.  This avoids crashes in GC.
 src/w32term.h (struct scroll_bar): Convert fringe_extended_p to a
 bool, so its address could be taken.

src/ChangeLog
src/w32term.c
src/w32term.h
src/window.c

index c60b2c1..6d2c572 100644 (file)
@@ -1,3 +1,15 @@
+2013-08-13  Eli Zaretskii  <eliz@gnu.org>
+
+       * window.c (Fwindow_margins): Return nil when there's no marginal
+       area, as per the documented API.
+
+       * w32term.c (x_scroll_bar_create): Use ALLOCATE_PSEUDOVECTOR, not
+       Fmake_vector, as scroll bar's struct members are not all Lisp
+       objects now.  This avoids crashes in GC.
+
+       * w32term.h (struct scroll_bar): Convert fringe_extended_p to a
+       bool, so its address could be taken.
+
 2013-08-13  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * image.c (imagemagick_filename_hint): New function to possibly
index 2b30673..03a9af1 100644 (file)
@@ -3757,7 +3757,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
   HWND hwnd;
   SCROLLINFO si;
   struct scroll_bar *bar
-    = XSCROLL_BAR (Fmake_vector (make_number (VECSIZE (struct scroll_bar)), Qnil));
+    = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, fringe_extended_p, PVEC_OTHER);
   Lisp_Object barobj;
 
   block_input ();
index 8a1bbd1..41c5c71 100644 (file)
@@ -453,7 +453,9 @@ struct scroll_bar {
 
   /* 1 if the background of the fringe that is adjacent to a scroll
      bar is extended to the gap between the fringe and the bar.  */
-  unsigned fringe_extended_p : 1;
+  /* Note: this could be a bit field, but we need to take its address
+     in ALLOCATE_PSEUDOVECTOR (see x_scroll_bar_create).  */
+  bool fringe_extended_p;
 };
 
 /* Turning a lisp vector value into a pointer to a struct scroll_bar.  */
index b33dc32..f9084e6 100644 (file)
@@ -6171,8 +6171,8 @@ as nil.  */)
   (Lisp_Object window)
 {
   struct window *w = decode_live_window (window);
-  return Fcons (make_number (w->left_margin_cols),
-               make_number (w->right_margin_cols));
+  return Fcons (w->left_margin_cols ? make_number (w->left_margin_cols) : Qnil,
+               w->right_margin_cols ? make_number (w->right_margin_cols) : Qnil);
 }