Mercurial > emacs
changeset 10771:d564078d10c6
(calculate_costs): Update max_frame_height, max_frame_width.
They determine length of chars_wasted, copybuf and char_ins_del_vector.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 17 Feb 1995 08:42:18 +0000 |
parents | 79745e047484 |
children | 3dc1120ac15c |
files | src/term.c |
diffstat | 1 files changed, 20 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/term.c Fri Feb 17 08:40:18 1995 +0000 +++ b/src/term.c Fri Feb 17 08:42:18 1995 +0000 @@ -254,8 +254,14 @@ /* internal state */ +/* The largest frame width in any call to calculate_costs. */ +int max_frame_width; +/* The largest frame height in any call to calculate_costs. */ +int max_frame_height; + /* Number of chars of space used for standout marker at beginning of line, or'd with 0100. Zero if no standout marker at all. + The length of these vectors is max_frame_height. Used IFF TN_standout_width >= 0. */ @@ -1014,7 +1020,8 @@ #ifndef old /* char_ins_del_cost[n] is cost of inserting N characters. - char_ins_del_cost[-n] is cost of deleting N characters. */ + char_ins_del_cost[-n] is cost of deleting N characters. + The length of this vector is based on max_frame_width. */ int *char_ins_del_vector; @@ -1115,30 +1122,33 @@ chars_wasted and copybuf are only used here in term.c in cases where the term hook isn't called. */ + max_frame_height = max (max_frame_height, FRAME_HEIGHT (frame)); + max_frame_width = max (max_frame_width, FRAME_WIDTH (frame)); + if (chars_wasted != 0) - chars_wasted = (char *) xrealloc (chars_wasted, FRAME_HEIGHT (frame)); + chars_wasted = (char *) xrealloc (chars_wasted, max_frame_height); else - chars_wasted = (char *) xmalloc (FRAME_HEIGHT (frame)); + chars_wasted = (char *) xmalloc (max_frame_height); if (copybuf != 0) - copybuf = (char *) xrealloc (copybuf, FRAME_HEIGHT (frame)); + copybuf = (char *) xrealloc (copybuf, max_frame_height); else - copybuf = (char *) xmalloc (FRAME_HEIGHT (frame)); + copybuf = (char *) xmalloc (max_frame_height); if (char_ins_del_vector != 0) char_ins_del_vector = (int *) xrealloc (char_ins_del_vector, (sizeof (int) - + 2 * FRAME_WIDTH (frame) * sizeof (int))); + + 2 * max_frame_width * sizeof (int))); else char_ins_del_vector = (int *) xmalloc (sizeof (int) - + 2 * FRAME_WIDTH (frame) * sizeof (int)); + + 2 * max_frame_width * sizeof (int)); - bzero (chars_wasted, FRAME_HEIGHT (frame)); - bzero (copybuf, FRAME_HEIGHT (frame)); + bzero (chars_wasted, max_frame_height); + bzero (copybuf, max_frame_height); bzero (char_ins_del_vector, (sizeof (int) - + 2 * FRAME_WIDTH (frame) * sizeof (int))); + + 2 * max_frame_width * sizeof (int))); if (f && (!TS_ins_line && !TS_del_line)) do_line_insertion_deletion_costs (frame,