projects
/
pspp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
229e0c3
)
ascii.c: Reallocate the lines after the page is resized
author
John Darrington
<john@darrington.wattle.id.au>
Sat, 25 Feb 2012 13:59:14 +0000
(14:59 +0100)
committer
John Darrington
<john@darrington.wattle.id.au>
Sun, 26 Feb 2012 18:32:17 +0000
(19:32 +0100)
src/output/ascii.c
patch
|
blob
|
history
diff --git
a/src/output/ascii.c
b/src/output/ascii.c
index e66f2a17bee20c073a2a2f7eb55593d892ec6513..1688fd1bf1217c8e0df48109eb64df2f7a45f1d9 100644
(file)
--- a/
src/output/ascii.c
+++ b/
src/output/ascii.c
@@
-202,6
+202,24
@@
static void ascii_draw_cell (void *, const struct table_cell *,
int bb[TABLE_N_AXES][2],
int clip[TABLE_N_AXES][2]);
int bb[TABLE_N_AXES][2],
int clip[TABLE_N_AXES][2]);
+static void
+reallocate_lines (struct ascii_driver *a)
+{
+ if (a->length > a->allocated_lines)
+ {
+ int i;
+ a->lines = xnrealloc (a->lines, a->length, sizeof *a->lines);
+ for (i = a->allocated_lines; i < a->length; i++)
+ {
+ struct ascii_line *line = &a->lines[i];
+ ds_init_empty (&line->s);
+ line->width = 0;
+ }
+ a->allocated_lines = a->length;
+ }
+}
+
+
static struct ascii_driver *
ascii_driver_cast (struct output_driver *driver)
{
static struct ascii_driver *
ascii_driver_cast (struct output_driver *driver)
{
@@
-340,6
+358,8
@@
update_page_size (struct ascii_driver *a, bool issue_error)
return false;
}
return false;
}
+ reallocate_lines (a);
+
return true;
}
return true;
}
@@
-1109,17
+1129,7
@@
ascii_open_page (struct ascii_driver *a)
a->page_number++;
a->page_number++;
- if (a->length > a->allocated_lines)
- {
- a->lines = xnrealloc (a->lines, a->length, sizeof *a->lines);
- for (i = a->allocated_lines; i < a->length; i++)
- {
- struct ascii_line *line = &a->lines[i];
- ds_init_empty (&line->s);
- line->width = 0;
- }
- a->allocated_lines = a->length;
- }
+ reallocate_lines (a);
for (i = 0; i < a->length; i++)
{
for (i = 0; i < a->length; i++)
{