diff options
| author | Richard M. Stallman | 1995-02-17 08:42:18 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-02-17 08:42:18 +0000 |
| commit | 8dd0c7cbf78b055502f4db018928a9ad24d89acd (patch) | |
| tree | 929af67b52f8c5a3137f93a3e0bd18b01f82cadf /src | |
| parent | 45140e01dc6646eb39eb4fcbfc2e73db78b86844 (diff) | |
| download | emacs-8dd0c7cbf78b055502f4db018928a9ad24d89acd.tar.gz emacs-8dd0c7cbf78b055502f4db018928a9ad24d89acd.zip | |
(calculate_costs): Update max_frame_height, max_frame_width.
They determine length of chars_wasted, copybuf and char_ins_del_vector.
Diffstat (limited to 'src')
| -rw-r--r-- | src/term.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/term.c b/src/term.c index e681c7f4bc9..463862a8adf 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -254,8 +254,14 @@ static int se_is_so; /* 1 if same string both enters and leaves | |||
| 254 | 254 | ||
| 255 | /* internal state */ | 255 | /* internal state */ |
| 256 | 256 | ||
| 257 | /* The largest frame width in any call to calculate_costs. */ | ||
| 258 | int max_frame_width; | ||
| 259 | /* The largest frame height in any call to calculate_costs. */ | ||
| 260 | int max_frame_height; | ||
| 261 | |||
| 257 | /* Number of chars of space used for standout marker at beginning of line, | 262 | /* Number of chars of space used for standout marker at beginning of line, |
| 258 | or'd with 0100. Zero if no standout marker at all. | 263 | or'd with 0100. Zero if no standout marker at all. |
| 264 | The length of these vectors is max_frame_height. | ||
| 259 | 265 | ||
| 260 | Used IFF TN_standout_width >= 0. */ | 266 | Used IFF TN_standout_width >= 0. */ |
| 261 | 267 | ||
| @@ -1014,7 +1020,8 @@ per_line_cost (str) | |||
| 1014 | 1020 | ||
| 1015 | #ifndef old | 1021 | #ifndef old |
| 1016 | /* char_ins_del_cost[n] is cost of inserting N characters. | 1022 | /* char_ins_del_cost[n] is cost of inserting N characters. |
| 1017 | char_ins_del_cost[-n] is cost of deleting N characters. */ | 1023 | char_ins_del_cost[-n] is cost of deleting N characters. |
| 1024 | The length of this vector is based on max_frame_width. */ | ||
| 1018 | 1025 | ||
| 1019 | int *char_ins_del_vector; | 1026 | int *char_ins_del_vector; |
| 1020 | 1027 | ||
| @@ -1115,30 +1122,33 @@ calculate_costs (frame) | |||
| 1115 | chars_wasted and copybuf are only used here in term.c in cases where | 1122 | chars_wasted and copybuf are only used here in term.c in cases where |
| 1116 | the term hook isn't called. */ | 1123 | the term hook isn't called. */ |
| 1117 | 1124 | ||
| 1125 | max_frame_height = max (max_frame_height, FRAME_HEIGHT (frame)); | ||
| 1126 | max_frame_width = max (max_frame_width, FRAME_WIDTH (frame)); | ||
| 1127 | |||
| 1118 | if (chars_wasted != 0) | 1128 | if (chars_wasted != 0) |
| 1119 | chars_wasted = (char *) xrealloc (chars_wasted, FRAME_HEIGHT (frame)); | 1129 | chars_wasted = (char *) xrealloc (chars_wasted, max_frame_height); |
| 1120 | else | 1130 | else |
| 1121 | chars_wasted = (char *) xmalloc (FRAME_HEIGHT (frame)); | 1131 | chars_wasted = (char *) xmalloc (max_frame_height); |
| 1122 | 1132 | ||
| 1123 | if (copybuf != 0) | 1133 | if (copybuf != 0) |
| 1124 | copybuf = (char *) xrealloc (copybuf, FRAME_HEIGHT (frame)); | 1134 | copybuf = (char *) xrealloc (copybuf, max_frame_height); |
| 1125 | else | 1135 | else |
| 1126 | copybuf = (char *) xmalloc (FRAME_HEIGHT (frame)); | 1136 | copybuf = (char *) xmalloc (max_frame_height); |
| 1127 | 1137 | ||
| 1128 | if (char_ins_del_vector != 0) | 1138 | if (char_ins_del_vector != 0) |
| 1129 | char_ins_del_vector | 1139 | char_ins_del_vector |
| 1130 | = (int *) xrealloc (char_ins_del_vector, | 1140 | = (int *) xrealloc (char_ins_del_vector, |
| 1131 | (sizeof (int) | 1141 | (sizeof (int) |
| 1132 | + 2 * FRAME_WIDTH (frame) * sizeof (int))); | 1142 | + 2 * max_frame_width * sizeof (int))); |
| 1133 | else | 1143 | else |
| 1134 | char_ins_del_vector | 1144 | char_ins_del_vector |
| 1135 | = (int *) xmalloc (sizeof (int) | 1145 | = (int *) xmalloc (sizeof (int) |
| 1136 | + 2 * FRAME_WIDTH (frame) * sizeof (int)); | 1146 | + 2 * max_frame_width * sizeof (int)); |
| 1137 | 1147 | ||
| 1138 | bzero (chars_wasted, FRAME_HEIGHT (frame)); | 1148 | bzero (chars_wasted, max_frame_height); |
| 1139 | bzero (copybuf, FRAME_HEIGHT (frame)); | 1149 | bzero (copybuf, max_frame_height); |
| 1140 | bzero (char_ins_del_vector, (sizeof (int) | 1150 | bzero (char_ins_del_vector, (sizeof (int) |
| 1141 | + 2 * FRAME_WIDTH (frame) * sizeof (int))); | 1151 | + 2 * max_frame_width * sizeof (int))); |
| 1142 | 1152 | ||
| 1143 | if (f && (!TS_ins_line && !TS_del_line)) | 1153 | if (f && (!TS_ins_line && !TS_del_line)) |
| 1144 | do_line_insertion_deletion_costs (frame, | 1154 | do_line_insertion_deletion_costs (frame, |