[vte] Revert 80dc9064
- From: Behdad Esfahbod <behdad src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [vte] Revert 80dc9064
- Date: Fri, 21 Aug 2009 16:21:01 +0000 (UTC)
commit 4e533b106a1c39b8565a9891fba83e384cc40669
Author: Behdad Esfahbod <behdad behdad org>
Date: Fri Aug 21 12:17:38 2009 -0400
Revert 80dc9064
Removing the optimization, so I can clean up the ring API and redesign
the implementation. Sorry Chris!
src/ring.c | 17 -----------------
src/ring.h | 5 -----
src/vte.c | 19 +++++++------------
3 files changed, 7 insertions(+), 34 deletions(-)
---
diff --git a/src/ring.c b/src/ring.c
index 2efa2b2..a3c4859 100644
--- a/src/ring.c
+++ b/src/ring.c
@@ -65,7 +65,6 @@ VteRing *
_vte_ring_new(glong max_elements)
{
VteRing *ret = g_slice_new0(VteRing);
- ret->cached_item = -1;
ret->max = MAX(max_elements, 2);
ret->array = g_malloc0(sizeof(gpointer) * ret->max);
return ret;
@@ -118,10 +117,6 @@ _vte_ring_insert(VteRing * ring, long position, gpointer data)
ring->array[position % ring->max] = data;
if (ring->length == ring->max) {
ring->delta++;
- if (ring->delta > ring->cached_item) {
- _vte_ring_set_cache (ring, -1, NULL);
- }
-
} else {
ring->length++;
}
@@ -133,10 +128,6 @@ _vte_ring_insert(VteRing * ring, long position, gpointer data)
return;
}
- if (position <= ring->cached_item) {
- _vte_ring_set_cache (ring, -1, NULL);
- }
-
/* All other cases. Calculate the location where the last "item" in the
* buffer is going to end up in the array. */
point = ring->delta + ring->length - 1;
@@ -197,10 +188,6 @@ _vte_ring_insert_preserve(VteRing * ring, long position, gpointer data)
position, ring->delta, ring->length, ring->max);
_vte_ring_validate(ring);
- if (position <= ring->cached_item) {
- _vte_ring_set_cache (ring, -1, NULL);
- }
-
/* Allocate space to save existing elements. */
point = _vte_ring_next(ring);
i = MAX(1, point - position);
@@ -251,10 +238,6 @@ _vte_ring_remove(VteRing * ring, long position, gboolean free_element)
position, ring->delta, ring->length, ring->max);
_vte_ring_validate(ring);
- if (position <= ring->cached_item) {
- _vte_ring_set_cache (ring, -1, NULL);
- }
-
i = position % ring->max;
/* Remove the data at this position. */
if (free_element)
diff --git a/src/ring.h b/src/ring.h
index 56368f2..55d7c18 100644
--- a/src/ring.h
+++ b/src/ring.h
@@ -35,8 +35,6 @@ typedef struct _VteRing VteRing;
struct _VteRing {
glong delta, length, max;
- glong cached_item;
- gpointer cached_data;
VteRowData **array;
};
@@ -47,9 +45,6 @@ struct _VteRing {
#define _vte_ring_length(__ring) ((__ring)->length)
#define _vte_ring_next(__ring) ((__ring)->delta + (__ring)->length)
#define _vte_ring_max(__ring) ((__ring)->max)
-#define _vte_ring_is_cached(__ring, __v) ((__ring)->cached_item == (__v))
-#define _vte_ring_get_cached_data(__ring) ((__ring)->cached_data)
-#define _vte_ring_set_cache(__ring, __v, __data) ((__ring)->cached_item = (__v), (__ring)->cached_data = (__data))
#ifdef VTE_DEBUG
#define _vte_ring_index(__ring, __position) \
((__ring)->array[(__position) % (__ring)->max] ? \
diff --git a/src/vte.c b/src/vte.c
index 478515a..a55c748 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -2331,19 +2331,14 @@ _vte_terminal_ensure_row (VteTerminal *terminal)
screen = terminal->pvt->screen;
v = screen->cursor_current.row;
- if (!_vte_ring_is_cached (screen->row_data, v)) {
- /* Figure out how many rows we need to add. */
- delta = v - _vte_ring_next(screen->row_data) + 1;
- if (delta > 0) {
- row = vte_terminal_insert_rows (terminal, delta);
- _vte_terminal_adjust_adjustments(terminal);
- } else {
- /* Find the row the cursor is in. */
- row = _vte_ring_index(screen->row_data, v);
- }
- _vte_ring_set_cache (screen->row_data, v, row);
+ /* Figure out how many rows we need to add. */
+ delta = v - _vte_ring_next(screen->row_data) + 1;
+ if (delta > 0) {
+ row = vte_terminal_insert_rows (terminal, delta);
+ _vte_terminal_adjust_adjustments(terminal);
} else {
- row = _vte_ring_get_cached_data (screen->row_data);
+ /* Find the row the cursor is in. */
+ row = _vte_ring_index(screen->row_data, v);
}
g_assert(row != NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]