diff options
| author | Paul Eggert | 2013-09-24 00:16:38 -0700 |
|---|---|---|
| committer | Paul Eggert | 2013-09-24 00:16:38 -0700 |
| commit | 9da0f50e5ab74e7543f169cef831cc8c22ef4f43 (patch) | |
| tree | f7bd8f7c4df27dbe45f640a535a88ac14d5753f8 /src | |
| parent | d6d9cbc15cbebfe466756a7a75601173c15287a2 (diff) | |
| download | emacs-9da0f50e5ab74e7543f169cef831cc8c22ef4f43.tar.gz emacs-9da0f50e5ab74e7543f169cef831cc8c22ef4f43.zip | |
* dispnew.c (clear_glyph_row, copy_row_except_pointers):
Prefer signed to unsigned integers where either will do.
No need for 'const' on locals that do not escape.
Omit easserts with unnecessary and unportable assumptions about
alignment. Avoid unnecessary casts to char *.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/dispnew.c | 10 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index a2eb39e7196..e4d9ad3b835 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2013-09-24 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | * dispnew.c (clear_glyph_row, copy_row_except_pointers): | ||
| 4 | Prefer signed to unsigned integers where either will do. | ||
| 5 | No need for 'const' on locals that do not escape. | ||
| 6 | Omit easserts with unnecessary and unportable assumptions about | ||
| 7 | alignment. Avoid unnecessary casts to char *. | ||
| 8 | |||
| 1 | 2013-09-24 Dmitry Antipov <dmantipov@yandex.ru> | 9 | 2013-09-24 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 10 | ||
| 3 | Use union for the payload of struct Lisp_Vector. | 11 | Use union for the payload of struct Lisp_Vector. |
diff --git a/src/dispnew.c b/src/dispnew.c index f7e3fa54441..f9132f37f68 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -838,11 +838,10 @@ clear_window_matrices (struct window *w, bool desired_p) | |||
| 838 | void | 838 | void |
| 839 | clear_glyph_row (struct glyph_row *row) | 839 | clear_glyph_row (struct glyph_row *row) |
| 840 | { | 840 | { |
| 841 | const size_t off = offsetof (struct glyph_row, used); | 841 | int off = offsetof (struct glyph_row, used); |
| 842 | 842 | ||
| 843 | eassert (off == sizeof row->glyphs); | ||
| 844 | /* Zero everything except pointers in `glyphs'. */ | 843 | /* Zero everything except pointers in `glyphs'. */ |
| 845 | memset ((char *) row + off, 0, sizeof *row - off); | 844 | memset (row->used, 0, sizeof *row - off); |
| 846 | } | 845 | } |
| 847 | 846 | ||
| 848 | 847 | ||
| @@ -989,10 +988,9 @@ swap_glyph_pointers (struct glyph_row *a, struct glyph_row *b) | |||
| 989 | static void | 988 | static void |
| 990 | copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from) | 989 | copy_row_except_pointers (struct glyph_row *to, struct glyph_row *from) |
| 991 | { | 990 | { |
| 992 | const size_t off = offsetof (struct glyph_row, x); | 991 | int off = offsetof (struct glyph_row, x); |
| 993 | 992 | ||
| 994 | eassert (off == sizeof to->glyphs + sizeof to->used + sizeof to->hash); | 993 | memcpy (&to->x, &from->x, sizeof *to - off); |
| 995 | memcpy ((char *) to + off, (char *) from + off, sizeof *to - off); | ||
| 996 | } | 994 | } |
| 997 | 995 | ||
| 998 | 996 | ||