1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 18:40:39 -08:00

Add new swap macro and use it

A `swap` macro prevents programming errors and is more concise.
It is a natural addition to our existing `min` and `max` macros.

* src/lisp.h (swap): New macro.
* lwlib/xlwmenu.c (draw_shadow_rectangle, draw_shadow_rhombus):
* src/androidterm.c (android_get_surrounding_text):
* src/buffer.c (Fmake_overlay, modify_overlay, Fmove_overlay):
* src/dispnew.c (swap_glyphs_in_rows, reverse_rows):
* src/editfns.c (Finsert_buffer_substring)
(Fcompare_buffer_substrings):
* src/eval.c (run_hook_wrapped_funcall):
* src/fns.c (extract_data_from_object):
* src/regex-emacs.c (forall_firstchar_1):
* src/textconv.c (textconv_query, get_extracted_text)
(get_surrounding_text):
* src/textprop.c (validate_interval_range)
(verify_interval_modification):
* src/w32uniscribe.c (OTF_INT16_VAL):
* src/xfaces.c (load_face_colors):
* src/xterm.c (SWAPCARD32): Prefer using above macro to open-coding.
This commit is contained in:
Stefan Kangas 2024-01-06 08:22:08 +01:00
parent 2740a3cbfd
commit 3788952327
14 changed files with 41 additions and 111 deletions

View file

@ -671,12 +671,7 @@ draw_shadow_rectangle (XlwMenuWidget mw, Window window, int x, int y,
}
if (!erase_p && down_p)
{
GC temp;
temp = top_gc;
top_gc = bottom_gc;
bottom_gc = temp;
}
swap (top_gc, bottom_gc);
/* Do draw (or erase) shadows */
points [0].x = x;
@ -757,12 +752,7 @@ draw_shadow_rhombus (XlwMenuWidget mw, Window window, int x, int y,
}
if (!erase_p && down_p)
{
GC temp;
temp = top_gc;
top_gc = bottom_gc;
bottom_gc = temp;
}
swap (top_gc, bottom_gc);
points [0].x = x;
points [0].y = y + height / 2;