From: Paul Eggert Date: Thu, 28 Jul 2011 23:47:01 +0000 (-0700) Subject: * fringe.c (Fdefine_fringe_bitmap): Don't update size until alloc works. X-Git-Tag: emacs-pretest-24.0.90~104^2~152^2~116 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=483a9e21b6c8387cdbd5a5f3ab8a3fe77f7e52a0;p=emacs.git * fringe.c (Fdefine_fringe_bitmap): Don't update size until alloc works. --- diff --git a/src/ChangeLog b/src/ChangeLog index e2b613d03c8..058c250a330 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2011-07-28 Paul Eggert + * fringe.c (Fdefine_fringe_bitmap): Don't update size until alloc works. + * frame.h (struct frame): Use int, not EMACS_INT, where int works. This is for the members text_lines, text_cols, total_lines, total_cols, where the system imposes an 'int' limit. diff --git a/src/fringe.c b/src/fringe.c index a4dc9433aff..5878c541247 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -1610,22 +1610,25 @@ If BITMAP already exists, the existing definition is replaced. */) if (n == max_fringe_bitmaps) { - if ((max_fringe_bitmaps + 20) > MAX_FRINGE_BITMAPS) + int bitmaps = max_fringe_bitmaps + 20; + if (MAX_FRINGE_BITMAPS < bitmaps) error ("No free fringe bitmap slots"); i = max_fringe_bitmaps; - max_fringe_bitmaps += 20; fringe_bitmaps = ((struct fringe_bitmap **) - xrealloc (fringe_bitmaps, max_fringe_bitmaps * sizeof (struct fringe_bitmap *))); + xrealloc (fringe_bitmaps, bitmaps * sizeof *fringe_bitmaps)); fringe_faces - = (Lisp_Object *) xrealloc (fringe_faces, max_fringe_bitmaps * sizeof (Lisp_Object)); + = (Lisp_Object *) xrealloc (fringe_faces, + bitmaps * sizeof *fringe_faces); - for (; i < max_fringe_bitmaps; i++) + for (i = max_fringe_bitmaps; i < bitmaps; i++) { fringe_bitmaps[i] = NULL; fringe_faces[i] = Qnil; } + + max_fringe_bitmaps = bitmaps; } }