[vte] [ring] Enlarge initial writable size
- From: Behdad Esfahbod <behdad src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [vte] [ring] Enlarge initial writable size
- Date: Tue, 8 Sep 2009 06:41:36 +0000 (UTC)
commit 5b559865f8237b4aa77c513a3d5847bf0a0e01aa
Author: Behdad Esfahbod <behdad behdad org>
Date: Mon Sep 7 21:00:13 2009 -0400
[ring] Enlarge initial writable size
src/ring.c | 8 +++++---
src/ring.h | 2 ++
src/vte-private.h | 1 -
3 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/ring.c b/src/ring.c
index af530d7..eaf5bd8 100644
--- a/src/ring.c
+++ b/src/ring.c
@@ -451,6 +451,7 @@ _vte_ring_chunk_new_compact (guint start)
chunk->base.offset = chunk->base.start = chunk->base.end = start;
chunk->base.mask = (guint) -1;
chunk->base.array = chunk->p.rows;
+
chunk->bytes_left = chunk->total_bytes;
chunk->cursor = chunk->p.data + chunk->bytes_left;
@@ -522,7 +523,8 @@ _vte_ring_chunk_init_writable (VteRingChunk *chunk)
chunk->type = VTE_RING_CHUNK_TYPE_WRITABLE;
chunk->offset = 0;
- chunk->mask = 63;
+ /* Allocate min of 512 and VTE_SCROLLBACK_INIT */
+ chunk->mask = MIN (512, (1 << g_bit_storage (VTE_SCROLLBACK_INIT - 1))) - 1;
chunk->array = g_malloc0 (sizeof (chunk->array[0]) * (chunk->mask + 1));
}
@@ -535,7 +537,7 @@ _vte_ring_chunk_fini_writable (VteRingChunk *chunk)
for (i = 0; i <= chunk->mask; i++)
_vte_row_data_fini (&chunk->array[i]);
- g_free(chunk->array);
+ g_free (chunk->array);
chunk->array = NULL;
}
@@ -622,7 +624,7 @@ _vte_ring_validate (VteRing * ring)
void
_vte_ring_init (VteRing *ring, guint max_rows)
{
- ring->max = MAX(max_rows, 2);
+ ring->max = MAX (max_rows, 2);
ring->tail = ring->cursor = ring->head;
diff --git a/src/ring.h b/src/ring.h
index 3205560..36a7f6b 100644
--- a/src/ring.h
+++ b/src/ring.h
@@ -29,6 +29,8 @@
G_BEGIN_DECLS
+#define VTE_SCROLLBACK_INIT 100
+
#define VTE_DEF_FG 256
#define VTE_DEF_BG 257
#define VTE_BOLD_FG 258
diff --git a/src/vte-private.h b/src/vte-private.h
index 2c3bc65..dbf43b4 100644
--- a/src/vte-private.h
+++ b/src/vte-private.h
@@ -64,7 +64,6 @@ G_BEGIN_DECLS
/* More color defines in ring.h */
#define VTE_SATURATION_MAX 10000
-#define VTE_SCROLLBACK_INIT 100
#define VTE_DEFAULT_CURSOR GDK_XTERM
#define VTE_MOUSING_CURSOR GDK_LEFT_PTR
#define VTE_TAB_MAX 999
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]