summaryrefslogtreecommitdiff
path: root/src/scroll.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-07-05 11:35:48 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2012-07-05 11:35:48 -0700
commit38182d901d030c7d65f4aa7a49b583afb30eb9b7 (patch)
treea69e1a571495d6ca1c034359d7c995639774ab9b /src/scroll.c
parent6dd5a677dbf794eedaa8325c46d57ac041373361 (diff)
downloademacs-38182d901d030c7d65f4aa7a49b583afb30eb9b7.tar.gz
More xmalloc and related cleanup.
* alloc.c, bidi.c, buffer.c, buffer.h, bytecode.c, callint.c: * callproc.c, charset.c, coding.c, composite.c, data.c, dispnew.c: * doc.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, fns.c: * font.c, fontset.c, frame.c, fringe.c, ftfont.c, ftxfont.c, gmalloc.c: * gtkutil.c, image.c, keyboard.c, keymap.c, lread.c, macros.c, menu.c: * nsfns.m, nsfont.m, nsmenu.m, nsterm.m, print.c, process.c, ralloc.c: * regex.c, region-cache.c, scroll.c, search.c, sound.c, syntax.c: * sysdep.c, term.c, termcap.c, unexmacosx.c, window.c, xdisp.c: * xfaces.c, xfns.c, xftfont.c, xgselect.c, xmenu.c, xrdb.c, xselect.c: * xterm.c: Omit needless casts involving void * pointers and allocation. Prefer "P = xmalloc (sizeof *P)" to "P = xmalloc (sizeof (TYPE_OF_P))", as the former is more robust if P's type is changed. Prefer xzalloc to xmalloc + memset 0. Simplify malloc-or-realloc to realloc. Don't worry about xmalloc returning a null pointer. Prefer xstrdup to xmalloc + strcpy. * editfns.c (Fmessage_box): Grow message_text by at least 80 when growing it. * keyboard.c (apply_modifiers_uncached): Prefer local array to alloca of a constant.
Diffstat (limited to 'src/scroll.c')
-rw-r--r--src/scroll.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/scroll.c b/src/scroll.c
index 86d775545b0..78ebe65bdcc 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -253,11 +253,11 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
/* A queue for line insertions to be done. */
struct queue { int count, pos; };
struct queue *queue_start
- = (struct queue *) alloca (current_matrix->nrows * sizeof (struct queue));
+ = alloca (current_matrix->nrows * sizeof *queue_start);
struct queue *queue = queue_start;
- char *retained_p = (char *) alloca (window_size * sizeof (char));
- int *copy_from = (int *) alloca (window_size * sizeof (int));
+ char *retained_p = alloca (window_size * sizeof *retained_p);
+ int *copy_from = alloca (window_size * sizeof *copy_from);
/* Zero means line is empty. */
memset (retained_p, 0, window_size * sizeof (char));
@@ -671,11 +671,11 @@ do_direct_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
int write_follows_p = 1;
/* For each row in the new matrix what row of the old matrix it is. */
- int *copy_from = (int *) alloca (window_size * sizeof (int));
+ int *copy_from = alloca (window_size * sizeof *copy_from);
/* Non-zero for each row in the new matrix that is retained from the
old matrix. Lines not retained are empty. */
- char *retained_p = (char *) alloca (window_size * sizeof (char));
+ char *retained_p = alloca (window_size * sizeof *retained_p);
memset (retained_p, 0, window_size * sizeof (char));