[vte] Simplify remove



commit e95ee843ef2954635ca3405f8de009fcb2095304
Author: Behdad Esfahbod <behdad behdad org>
Date:   Wed Aug 26 00:08:10 2009 -0400

    Simplify remove

 src/ring.c   |    4 ++--
 src/vte.c    |    3 +--
 src/vteseq.c |    3 +--
 3 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/src/ring.c b/src/ring.c
index f92e340..10a8736 100644
--- a/src/ring.c
+++ b/src/ring.c
@@ -216,8 +216,8 @@ _vte_ring_remove(VteRing * ring, long position)
 {
 	long i;
 
-	g_return_if_fail(position >= ring->delta);
-	g_return_if_fail(position < ring->delta + ring->length);
+	if (G_UNLIKELY (!_vte_ring_contains (ring, position)))
+		return;
 
 	_vte_debug_print(VTE_DEBUG_RING, "Removing item at position %ld.\n", position);
 	_vte_ring_validate(ring);
diff --git a/src/vte.c b/src/vte.c
index 29e3c24..f2ee482 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -314,8 +314,7 @@ vte_insert_line_internal(VteTerminal *terminal, glong position)
 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);
+	_vte_ring_remove(terminal->pvt->screen->row_data, position);
 }
 
 
diff --git a/src/vteseq.c b/src/vteseq.c
index dacc255..8ee0270 100644
--- a/src/vteseq.c
+++ b/src/vteseq.c
@@ -133,8 +133,7 @@ vte_insert_line_internal(VteTerminal *terminal, glong position)
 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);
+	_vte_ring_remove(terminal->pvt->screen->row_data, position);
 }
 
 /* Check how long a string of unichars is.  Slow version. */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]