Commit e6c21870 authored by Chris Wilson's avatar Chris Wilson Committed by Chris Wilson
Browse files

Export _vte_row_data_free.

2007-11-16  Chris Wilson  <chris@chris-wilson.co.uk>

    * src/vte-private.h:
    * src/vte.c (_vte_free_row_data), (vte_terminal_reset_rowdata),
    (vte_terminal_finalize), (vte_terminal_reset):
        Export _vte_row_data_free.

    * src/vteseq.c (vte_remove_line_internal):
        Cache the removed VteRowData - fixes the continual reallocation
        of row data during the vim scrolling benchmark.


svn path=/trunk/; revision=1976
parent bf8149c2
2007-11-16 Chris Wilson <chris@chris-wilson.co.uk>
* src/vte-private.h:
* src/vte.c (_vte_free_row_data), (vte_terminal_reset_rowdata),
(vte_terminal_finalize), (vte_terminal_reset):
Export _vte_row_data_free.
* src/vteseq.c (vte_remove_line_internal):
Cache the removed VteRowData - fixes the continual reallocation
of row data during the vim scrolling benchmark.
2007-11-16 Chris Wilson <chris@chris-wilson.co.uk>
* src/vte.c (release_chunk), (prune_chunks),
......
......@@ -394,6 +394,7 @@ void _vte_invalidate_cursor_once(VteTerminal *terminal, gboolean periodic);
VteRowData * _vte_new_row_data(VteTerminal *terminal);
VteRowData * _vte_new_row_data_sized(VteTerminal *terminal, gboolean fill);
VteRowData * _vte_reset_row_data (VteTerminal *terminal, VteRowData *row, gboolean fill);
void _vte_free_row_data(VteRowData *row);
void _vte_terminal_adjust_adjustments(VteTerminal *terminal);
void _vte_terminal_queue_contents_changed(VteTerminal *terminal);
void _vte_terminal_emit_text_deleted(VteTerminal *terminal);
......
......@@ -254,14 +254,11 @@ G_DEFINE_TYPE(VteTerminal, vte_terminal, GTK_TYPE_WIDGET)
static const guchar corresponding_dim_index[] = {16,88,28,100,18,90,30,102};
/* Free a no-longer-used row data array. */
static void
vte_free_row_data(gpointer freeing, gpointer data)
void
_vte_free_row_data(VteRowData *row)
{
if (freeing) {
VteRowData *row = freeing;
g_array_free(row->cells, TRUE);
g_slice_free(VteRowData, row);
}
g_array_free(row->cells, TRUE);
g_slice_free(VteRowData, row);
}
/* Append a single item to a GArray a given number of times. Centralizing all
......@@ -7257,7 +7254,7 @@ vte_terminal_reset_rowdata(VteRing **ring, glong lines)
}
new_ring = _vte_ring_new_with_delta(lines,
*ring ? _vte_ring_delta(*ring) : 0,
vte_free_row_data,
(GFunc) _vte_free_row_data,
NULL);
if (*ring) {
next = _vte_ring_next(*ring);
......@@ -7265,7 +7262,7 @@ vte_terminal_reset_rowdata(VteRing **ring, glong lines)
row = _vte_ring_index(*ring, VteRowData *, i);
row = _vte_ring_append(new_ring, row);
if (row) {
vte_free_row_data (row, NULL);
_vte_free_row_data (row);
}
}
_vte_ring_free(*ring, FALSE);
......@@ -7817,7 +7814,7 @@ vte_terminal_finalize(GObject *object)
_vte_ring_free(terminal->pvt->normal_screen.row_data, TRUE);
_vte_ring_free(terminal->pvt->alternate_screen.row_data, TRUE);
if (terminal->pvt->free_row) {
vte_free_row_data (terminal->pvt->free_row, NULL);
_vte_free_row_data (terminal->pvt->free_row);
}
/* Clear the status lines. */
......@@ -11664,11 +11661,11 @@ vte_terminal_reset(VteTerminal *terminal, gboolean full, gboolean clear_history)
_vte_ring_free(terminal->pvt->normal_screen.row_data, TRUE);
terminal->pvt->normal_screen.row_data =
_vte_ring_new(terminal->pvt->scrollback_lines,
vte_free_row_data, NULL);
(GFunc) _vte_free_row_data, NULL);
_vte_ring_free(terminal->pvt->alternate_screen.row_data, TRUE);
terminal->pvt->alternate_screen.row_data =
_vte_ring_new(terminal->pvt->scrollback_lines,
vte_free_row_data, NULL);
(GFunc) _vte_free_row_data, NULL);
terminal->pvt->normal_screen.cursor_saved.row = 0;
terminal->pvt->normal_screen.cursor_saved.col = 0;
terminal->pvt->normal_screen.cursor_current.row = 0;
......
......@@ -226,8 +226,13 @@ static void
vte_remove_line_internal(VteTerminal *terminal, glong position)
{
if (_vte_ring_next(terminal->pvt->screen->row_data) > position) {
_vte_ring_remove(terminal->pvt->screen->row_data,
position, TRUE);
if (terminal->pvt->free_row)
_vte_free_row_data (terminal->pvt->free_row);
terminal->pvt->free_row = _vte_ring_remove(
terminal->pvt->screen->row_data,
position,
FALSE);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment