aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2013-01-17 10:29:40 +0400
committerDmitry Antipov2013-01-17 10:29:40 +0400
commit468afbaceaeb045f69b1a47aa1550a2556cd7dfd (patch)
treeff5bd77d87a3f52802196d04ef4c6ca493c47fe7 /src
parent0e70695aa48cb34d8c3df6e4d4173b6adb474b23 (diff)
downloademacs-468afbaceaeb045f69b1a47aa1550a2556cd7dfd.tar.gz
emacs-468afbaceaeb045f69b1a47aa1550a2556cd7dfd.zip
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog16
-rw-r--r--src/alloc.c20
-rw-r--r--src/dired.c4
-rw-r--r--src/editfns.c4
-rw-r--r--src/fileio.c4
-rw-r--r--src/font.c2
-rw-r--r--src/ftfont.c2
-rw-r--r--src/gtkutil.c2
-rw-r--r--src/keymap.c2
-rw-r--r--src/lisp.h63
-rw-r--r--src/lread.c2
-rw-r--r--src/nsmenu.m2
-rw-r--r--src/nsterm.m2
-rw-r--r--src/xfns.c2
-rw-r--r--src/xmenu.c10
-rw-r--r--src/xselect.c2
16 files changed, 101 insertions, 38 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 316995bf20b..c85e0a789ea 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,21 @@
12013-01-17 Dmitry Antipov <dmantipov@yandex.ru> 12013-01-17 Dmitry Antipov <dmantipov@yandex.ru>
2 2
3 * lisp.h (toplevel): Add comment about using Lisp_Save_Value
4 objects, related functions and macros.
5 (make_save_value): Adjust prototype.
6 (make_save_pointer): New prototype.
7 (SAFE_NALLOCA): Fix indentation. Use make_save_pointer.
8 (SAFE_ALLOCA_LISP): Adjust make_save_value usage.
9 * alloc.c (format_save_value): Rename to make_save_value.
10 (make_save_pointer): New function.
11 (record_xmalloc): Use make_save_pointer.
12 * dired.c, editfns.c, fileio.c, font.c, gtkutil.c, lread.c:
13 * nsmenu.m, nsterm.m, xfns.c, xmenu.c, xselect.c, keymap.c:
14 Change users of make_save_value to make_save_pointer.
15 Likewise for format_save_value and make_save_value.
16
172013-01-17 Dmitry Antipov <dmantipov@yandex.ru>
18
3 * buffer.h (NARROWED, BUF_NARROWED): Drop unused macros. 19 * buffer.h (NARROWED, BUF_NARROWED): Drop unused macros.
4 (DECODE_POSITION, BUFFER_CHECK_INDIRECTION): Fix indentation. 20 (DECODE_POSITION, BUFFER_CHECK_INDIRECTION): Fix indentation.
5 * buffer.c (toplevel, syms_of_buffer): Drop old commented-out 21 * buffer.c (toplevel, syms_of_buffer): Drop old commented-out
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 *
845record_xmalloc (size_t size) 845record_xmalloc (size_t size)
846{ 846{
847 void *p = xmalloc (size); 847 void *p = xmalloc (size);
848 record_unwind_protect (safe_alloca_unwind, make_save_value (p, 0)); 848 record_unwind_protect (safe_alloca_unwind, make_save_pointer (p));
849 return p; 849 return p;
850} 850}
851 851
@@ -3356,7 +3356,7 @@ free_misc (Lisp_Object misc)
3356 and `o' for Lisp_Object. Up to 4 objects can be specified. */ 3356 and `o' for Lisp_Object. Up to 4 objects can be specified. */
3357 3357
3358Lisp_Object 3358Lisp_Object
3359format_save_value (const char *fmt, ...) 3359make_save_value (const char *fmt, ...)
3360{ 3360{
3361 va_list ap; 3361 va_list ap;
3362 int len = strlen (fmt); 3362 int len = strlen (fmt);
@@ -3404,15 +3404,19 @@ format_save_value (const char *fmt, ...)
3404 return val; 3404 return val;
3405} 3405}
3406 3406
3407/* Return a Lisp_Save_Value object containing POINTER and INTEGER. 3407/* The most common task it to save just one C pointer. */
3408 Most code should use this to package C integers and pointers
3409 to call record_unwind_protect. The unwind function can get the
3410 C values back using XSAVE_POINTER and XSAVE_INTEGER. */
3411 3408
3412Lisp_Object 3409Lisp_Object
3413make_save_value (void *pointer, ptrdiff_t integer) 3410make_save_pointer (void *pointer)
3414{ 3411{
3415 return format_save_value ("pi", pointer, integer); 3412 Lisp_Object val = allocate_misc (Lisp_Misc_Save_Value);
3413 struct Lisp_Save_Value *p = XSAVE_VALUE (val);
3414
3415 p->area = 0;
3416 p->type0 = SAVE_POINTER;
3417 p->data[0].pointer = pointer;
3418 p->type1 = p->type2 = p->type3 = SAVE_UNUSED;
3419 return val;
3416} 3420}
3417 3421
3418/* Free a Lisp_Save_Value object. Do not use this function 3422/* Free a Lisp_Save_Value object. Do not use this function
diff --git a/src/dired.c b/src/dired.c
index 3dca9d24f67..a4c8621e9c0 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -152,7 +152,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
152 file-attributes on filenames, both of which can throw, so we must 152 file-attributes on filenames, both of which can throw, so we must
153 do a proper unwind-protect. */ 153 do a proper unwind-protect. */
154 record_unwind_protect (directory_files_internal_unwind, 154 record_unwind_protect (directory_files_internal_unwind,
155 make_save_value (d, 0)); 155 make_save_pointer (d));
156 156
157#ifdef WINDOWSNT 157#ifdef WINDOWSNT
158 if (attrs) 158 if (attrs)
@@ -465,7 +465,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag,
465 report_file_error ("Opening directory", Fcons (dirname, Qnil)); 465 report_file_error ("Opening directory", Fcons (dirname, Qnil));
466 466
467 record_unwind_protect (directory_files_internal_unwind, 467 record_unwind_protect (directory_files_internal_unwind,
468 make_save_value (d, 0)); 468 make_save_pointer (d));
469 469
470 /* Loop reading blocks */ 470 /* Loop reading blocks */
471 /* (att3b compiler bug requires do a null comparison this way) */ 471 /* (att3b compiler bug requires do a null comparison this way) */
diff --git a/src/editfns.c b/src/editfns.c
index 8910b66e4d3..197950517b7 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -833,7 +833,7 @@ This function does not move point. */)
833Lisp_Object 833Lisp_Object
834save_excursion_save (void) 834save_excursion_save (void)
835{ 835{
836 return format_save_value 836 return make_save_value
837 ("oooo", 837 ("oooo",
838 Fpoint_marker (), 838 Fpoint_marker (),
839 /* Do not copy the mark if it points to nowhere. */ 839 /* Do not copy the mark if it points to nowhere. */
@@ -4249,7 +4249,7 @@ usage: (format STRING &rest OBJECTS) */)
4249 { 4249 {
4250 buf = xmalloc (bufsize); 4250 buf = xmalloc (bufsize);
4251 sa_must_free = 1; 4251 sa_must_free = 1;
4252 buf_save_value = make_save_value (buf, 0); 4252 buf_save_value = make_save_pointer (buf);
4253 record_unwind_protect (safe_alloca_unwind, buf_save_value); 4253 record_unwind_protect (safe_alloca_unwind, buf_save_value);
4254 memcpy (buf, initial_buffer, used); 4254 memcpy (buf, initial_buffer, used);
4255 } 4255 }
diff --git a/src/fileio.c b/src/fileio.c
index 87d945c1e5e..8d711e8e6bf 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4249,7 +4249,7 @@ by calling `format-decode', which see. */)
4249 to be signaled after decoding the text we read. */ 4249 to be signaled after decoding the text we read. */
4250 nbytes = internal_condition_case_1 4250 nbytes = internal_condition_case_1
4251 (read_non_regular, 4251 (read_non_regular,
4252 format_save_value ("iii", (ptrdiff_t) fd, inserted, trytry), 4252 make_save_value ("iii", (ptrdiff_t) fd, inserted, trytry),
4253 Qerror, read_non_regular_quit); 4253 Qerror, read_non_regular_quit);
4254 4254
4255 if (NILP (nbytes)) 4255 if (NILP (nbytes))
@@ -5608,7 +5608,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5608 } 5608 }
5609 5609
5610 record_unwind_protect (do_auto_save_unwind, 5610 record_unwind_protect (do_auto_save_unwind,
5611 make_save_value (stream, 0)); 5611 make_save_pointer (stream));
5612 record_unwind_protect (do_auto_save_unwind_1, 5612 record_unwind_protect (do_auto_save_unwind_1,
5613 make_number (minibuffer_auto_raise)); 5613 make_number (minibuffer_auto_raise));
5614 minibuffer_auto_raise = 0; 5614 minibuffer_auto_raise = 0;
diff --git a/src/font.c b/src/font.c
index 89931f6ec76..18caf751643 100644
--- a/src/font.c
+++ b/src/font.c
@@ -1861,7 +1861,7 @@ otf_open (Lisp_Object file)
1861 else 1861 else
1862 { 1862 {
1863 otf = STRINGP (file) ? OTF_open (SSDATA (file)) : NULL; 1863 otf = STRINGP (file) ? OTF_open (SSDATA (file)) : NULL;
1864 val = make_save_value (otf, 0); 1864 val = make_save_pointer (otf);
1865 otf_list = Fcons (Fcons (file, val), otf_list); 1865 otf_list = Fcons (Fcons (file, val), otf_list);
1866 } 1866 }
1867 return otf; 1867 return otf;
diff --git a/src/ftfont.c b/src/ftfont.c
index 5bf91832c7c..03e40bf2e46 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -393,7 +393,7 @@ ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for)
393 cache_data = xmalloc (sizeof *cache_data); 393 cache_data = xmalloc (sizeof *cache_data);
394 cache_data->ft_face = NULL; 394 cache_data->ft_face = NULL;
395 cache_data->fc_charset = NULL; 395 cache_data->fc_charset = NULL;
396 val = make_save_value (cache_data, 0); 396 val = make_save_value ("pi", cache_data, 0);
397 cache = Fcons (Qnil, val); 397 cache = Fcons (Qnil, val);
398 Fputhash (key, cache, ft_face_cache); 398 Fputhash (key, cache, ft_face_cache);
399 } 399 }
diff --git a/src/gtkutil.c b/src/gtkutil.c
index f045deacd33..d5bc159c063 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1716,7 +1716,7 @@ xg_dialog_run (FRAME_PTR f, GtkWidget *w)
1716 g_signal_connect (G_OBJECT (w), "delete-event", G_CALLBACK (gtk_true), NULL); 1716 g_signal_connect (G_OBJECT (w), "delete-event", G_CALLBACK (gtk_true), NULL);
1717 gtk_widget_show (w); 1717 gtk_widget_show (w);
1718 1718
1719 record_unwind_protect (pop_down_dialog, make_save_value (&dd, 0)); 1719 record_unwind_protect (pop_down_dialog, make_save_pointer (&dd));
1720 1720
1721 (void) xg_maybe_add_timer (&dd); 1721 (void) xg_maybe_add_timer (&dd);
1722 g_main_loop_run (dd.loop); 1722 g_main_loop_run (dd.loop);
diff --git a/src/keymap.c b/src/keymap.c
index a9266120e86..1e201e06dc3 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -610,7 +610,7 @@ map_keymap_internal (Lisp_Object map,
610 } 610 }
611 else if (CHAR_TABLE_P (binding)) 611 else if (CHAR_TABLE_P (binding))
612 map_char_table (map_keymap_char_table_item, Qnil, binding, 612 map_char_table (map_keymap_char_table_item, Qnil, binding,
613 format_save_value ("ppo", fun, data, args)); 613 make_save_value ("ppo", fun, data, args));
614 } 614 }
615 UNGCPRO; 615 UNGCPRO;
616 return tail; 616 return tail;
diff --git a/src/lisp.h b/src/lisp.h
index 40e4821bc10..5c81bc5dd8a 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1388,7 +1388,50 @@ enum
1388 SAVE_OBJECT 1388 SAVE_OBJECT
1389 }; 1389 };
1390 1390
1391/* Special object used to hold a different values for later use. */ 1391/* Special object used to hold a different values for later use.
1392
1393 This is mostly used to package C integers and pointers to call
1394 record_unwind_protect. Typical task is to pass just one C pointer
1395 to unwind function. You should pack pointer with make_save_pointer
1396 and then get it back with XSAVE_POINTER, e.g.:
1397
1398 ...
1399 struct my_data *md = get_my_data ();
1400 record_unwind_protect (my_unwind, make_save_pointer (md));
1401 ...
1402
1403 Lisp_Object my_unwind (Lisp_Object arg)
1404 {
1405 struct my_data *md = XSAVE_POINTER (arg, 0);
1406 ...
1407 }
1408
1409 If yon need to pass more than just one C pointer, you should
1410 use make_save_value. This function allows you to pack up to
1411 4 integers, pointers or Lisp_Objects and conveniently get them
1412 back with XSAVE_POINTER, XSAVE_INTEGER and XSAVE_OBJECT macros:
1413
1414 ...
1415 struct my_data *md = get_my_data ();
1416 ptrdiff_t my_offset = get_my_offset ();
1417 Lisp_Object my_object = get_my_object ();
1418 record_unwind_protect
1419 (my_unwind, make_save_value ("pio", md, my_offset, my_object));
1420 ...
1421
1422 Lisp_Object my_unwind (Lisp_Object arg)
1423 {
1424 struct my_data *md = XSAVE_POINTER (arg, 0);
1425 ptrdiff_t my_offset = XSAVE_INTEGER (arg, 1);
1426 Lisp_Object my_object = XSAVE_OBJECT (arg, 2);
1427 ...
1428 }
1429
1430 If ENABLE_CHECKING is in effect, XSAVE_xxx macros do type checking of the
1431 saved objects and raise eassert if type of the saved object doesn't match
1432 the type which is extracted. In the example above, XSAVE_INTEGER (arg, 2)
1433 or XSAVE_OBJECT (arg, 1) are wrong because integer was saved in slot 1 and
1434 Lisp_Object was saved in slot 2 of ARG. */
1392 1435
1393struct Lisp_Save_Value 1436struct Lisp_Save_Value
1394 { 1437 {
@@ -3018,8 +3061,8 @@ extern bool abort_on_gc;
3018extern Lisp_Object make_float (double); 3061extern Lisp_Object make_float (double);
3019extern void display_malloc_warning (void); 3062extern void display_malloc_warning (void);
3020extern ptrdiff_t inhibit_garbage_collection (void); 3063extern ptrdiff_t inhibit_garbage_collection (void);
3021extern Lisp_Object format_save_value (const char *, ...); 3064extern Lisp_Object make_save_value (const char *, ...);
3022extern Lisp_Object make_save_value (void *, ptrdiff_t); 3065extern Lisp_Object make_save_pointer (void *);
3023extern Lisp_Object build_overlay (Lisp_Object, Lisp_Object, Lisp_Object); 3066extern Lisp_Object build_overlay (Lisp_Object, Lisp_Object, Lisp_Object);
3024extern void free_marker (Lisp_Object); 3067extern void free_marker (Lisp_Object);
3025extern void free_cons (struct Lisp_Cons *); 3068extern void free_cons (struct Lisp_Cons *);
@@ -3701,16 +3744,16 @@ extern void *record_xmalloc (size_t);
3701 NITEMS items, each of the same type as *BUF. MULTIPLIER must 3744 NITEMS items, each of the same type as *BUF. MULTIPLIER must
3702 positive. The code is tuned for MULTIPLIER being a constant. */ 3745 positive. The code is tuned for MULTIPLIER being a constant. */
3703 3746
3704#define SAFE_NALLOCA(buf, multiplier, nitems) \ 3747#define SAFE_NALLOCA(buf, multiplier, nitems) \
3705 do { \ 3748 do { \
3706 if ((nitems) <= MAX_ALLOCA / sizeof *(buf) / (multiplier)) \ 3749 if ((nitems) <= MAX_ALLOCA / sizeof *(buf) / (multiplier)) \
3707 (buf) = alloca (sizeof *(buf) * (multiplier) * (nitems)); \ 3750 (buf) = alloca (sizeof *(buf) * (multiplier) * (nitems)); \
3708 else \ 3751 else \
3709 { \ 3752 { \
3710 (buf) = xnmalloc (nitems, sizeof *(buf) * (multiplier)); \ 3753 (buf) = xnmalloc (nitems, sizeof *(buf) * (multiplier)); \
3711 sa_must_free = 1; \ 3754 sa_must_free = 1; \
3712 record_unwind_protect (safe_alloca_unwind, \ 3755 record_unwind_protect (safe_alloca_unwind, \
3713 make_save_value (buf, 0)); \ 3756 make_save_pointer (buf)); \
3714 } \ 3757 } \
3715 } while (0) 3758 } while (0)
3716 3759
@@ -3735,7 +3778,7 @@ extern void *record_xmalloc (size_t);
3735 { \ 3778 { \
3736 Lisp_Object arg_; \ 3779 Lisp_Object arg_; \
3737 buf = xmalloc ((nelt) * word_size); \ 3780 buf = xmalloc ((nelt) * word_size); \
3738 arg_ = make_save_value (buf, nelt); \ 3781 arg_ = make_save_value ("pi", buf, nelt); \
3739 XSAVE_VALUE (arg_)->area = 1; \ 3782 XSAVE_VALUE (arg_)->area = 1; \
3740 sa_must_free = 1; \ 3783 sa_must_free = 1; \
3741 record_unwind_protect (safe_alloca_unwind, arg_); \ 3784 record_unwind_protect (safe_alloca_unwind, arg_); \
diff --git a/src/lread.c b/src/lread.c
index a01cf099b49..09eccb0fb30 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1298,7 +1298,7 @@ Return t if the file exists and loads successfully. */)
1298 message_with_string ("Loading %s...", file, 1); 1298 message_with_string ("Loading %s...", file, 1);
1299 } 1299 }
1300 1300
1301 record_unwind_protect (load_unwind, make_save_value (stream, 0)); 1301 record_unwind_protect (load_unwind, make_save_pointer (stream));
1302 record_unwind_protect (load_descriptor_unwind, load_descriptor_list); 1302 record_unwind_protect (load_descriptor_unwind, load_descriptor_list);
1303 specbind (Qload_file_name, found); 1303 specbind (Qload_file_name, found);
1304 specbind (Qinhibit_file_name_operation, Qnil); 1304 specbind (Qinhibit_file_name_operation, Qnil);
diff --git a/src/nsmenu.m b/src/nsmenu.m
index b0369e76a27..6899e3575f5 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1440,7 +1440,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
1440 unwind_data->pool = pool; 1440 unwind_data->pool = pool;
1441 unwind_data->dialog = dialog; 1441 unwind_data->dialog = dialog;
1442 1442
1443 record_unwind_protect (pop_down_menu, make_save_value (unwind_data, 0)); 1443 record_unwind_protect (pop_down_menu, make_save_pointer (unwind_data));
1444 popup_activated_flag = 1; 1444 popup_activated_flag = 1;
1445 tem = [dialog runDialogAt: p]; 1445 tem = [dialog runDialogAt: p];
1446 unbind_to (specpdl_count, Qnil); /* calls pop_down_menu */ 1446 unbind_to (specpdl_count, Qnil); /* calls pop_down_menu */
diff --git a/src/nsterm.m b/src/nsterm.m
index 48efac3f70b..d346f05624b 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3677,7 +3677,7 @@ ns_set_vertical_scroll_bar (struct window *window,
3677 } 3677 }
3678 3678
3679 bar = [[EmacsScroller alloc] initFrame: r window: win]; 3679 bar = [[EmacsScroller alloc] initFrame: r window: win];
3680 wset_vertical_scroll_bar (window, make_save_value (bar, 0)); 3680 wset_vertical_scroll_bar (window, make_save_pointer (bar));
3681 } 3681 }
3682 else 3682 else
3683 { 3683 {
diff --git a/src/xfns.c b/src/xfns.c
index 65148d1c9e1..f01983fea4d 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5416,7 +5416,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
5416 XmStringFree (default_xmstring); 5416 XmStringFree (default_xmstring);
5417 } 5417 }
5418 5418
5419 record_unwind_protect (clean_up_file_dialog, make_save_value (dialog, 0)); 5419 record_unwind_protect (clean_up_file_dialog, make_save_pointer (dialog));
5420 5420
5421 /* Process events until the user presses Cancel or OK. */ 5421 /* Process events until the user presses Cancel or OK. */
5422 x_menu_set_in_use (1); 5422 x_menu_set_in_use (1);
diff --git a/src/xmenu.c b/src/xmenu.c
index 7f6914d26ac..958cd220393 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1477,7 +1477,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y,
1477 gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i, 1477 gtk_menu_popup (GTK_MENU (menu), 0, 0, pos_func, &popup_x_y, i,
1478 timestamp ? timestamp : gtk_get_current_event_time ()); 1478 timestamp ? timestamp : gtk_get_current_event_time ());
1479 1479
1480 record_unwind_protect (pop_down_menu, make_save_value (menu, 0)); 1480 record_unwind_protect (pop_down_menu, make_save_pointer (menu));
1481 1481
1482 if (gtk_widget_get_mapped (menu)) 1482 if (gtk_widget_get_mapped (menu))
1483 { 1483 {
@@ -1826,7 +1826,7 @@ xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
1826 /* Make sure to free the widget_value objects we used to specify the 1826 /* Make sure to free the widget_value objects we used to specify the
1827 contents even with longjmp. */ 1827 contents even with longjmp. */
1828 record_unwind_protect (cleanup_widget_value_tree, 1828 record_unwind_protect (cleanup_widget_value_tree,
1829 make_save_value (first_wv, 0)); 1829 make_save_pointer (first_wv));
1830 1830
1831 /* Actually create and show the menu until popped down. */ 1831 /* Actually create and show the menu until popped down. */
1832 create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp); 1832 create_and_show_popup_menu (f, first_wv, x, y, for_click, timestamp);
@@ -1925,7 +1925,7 @@ create_and_show_dialog (FRAME_PTR f, widget_value *first_wv)
1925 if (menu) 1925 if (menu)
1926 { 1926 {
1927 ptrdiff_t specpdl_count = SPECPDL_INDEX (); 1927 ptrdiff_t specpdl_count = SPECPDL_INDEX ();
1928 record_unwind_protect (pop_down_menu, make_save_value (menu, 0)); 1928 record_unwind_protect (pop_down_menu, make_save_pointer (menu));
1929 1929
1930 /* Display the menu. */ 1930 /* Display the menu. */
1931 gtk_widget_show_all (menu); 1931 gtk_widget_show_all (menu);
@@ -2136,7 +2136,7 @@ xdialog_show (FRAME_PTR f,
2136 /* Make sure to free the widget_value objects we used to specify the 2136 /* Make sure to free the widget_value objects we used to specify the
2137 contents even with longjmp. */ 2137 contents even with longjmp. */
2138 record_unwind_protect (cleanup_widget_value_tree, 2138 record_unwind_protect (cleanup_widget_value_tree,
2139 make_save_value (first_wv, 0)); 2139 make_save_pointer (first_wv));
2140 2140
2141 /* Actually create and show the dialog. */ 2141 /* Actually create and show the dialog. */
2142 create_and_show_dialog (f, first_wv); 2142 create_and_show_dialog (f, first_wv);
@@ -2479,7 +2479,7 @@ xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
2479#endif 2479#endif
2480 2480
2481 record_unwind_protect (pop_down_menu, 2481 record_unwind_protect (pop_down_menu,
2482 format_save_value ("pp", f, menu)); 2482 make_save_value ("pp", f, menu));
2483 2483
2484 /* Help display under X won't work because XMenuActivate contains 2484 /* Help display under X won't work because XMenuActivate contains
2485 a loop that doesn't give Emacs a chance to process it. */ 2485 a loop that doesn't give Emacs a chance to process it. */
diff --git a/src/xselect.c b/src/xselect.c
index b7cdf70ff77..37d2c753c5e 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1141,7 +1141,7 @@ wait_for_property_change (struct prop_location *location)
1141 1141
1142 /* Make sure to do unexpect_property_change if we quit or err. */ 1142 /* Make sure to do unexpect_property_change if we quit or err. */
1143 record_unwind_protect (wait_for_property_change_unwind, 1143 record_unwind_protect (wait_for_property_change_unwind,
1144 make_save_value (location, 0)); 1144 make_save_pointer (location));
1145 1145
1146 XSETCAR (property_change_reply, Qnil); 1146 XSETCAR (property_change_reply, Qnil);
1147 property_change_reply_object = location; 1147 property_change_reply_object = location;