[vte] [ring] Fix brokenness with macro implementation



commit 71a6cf23eeb0237858b7b769074ed9c5bb564c3d
Author: Behdad Esfahbod <behdad behdad org>
Date:   Thu Aug 27 17:07:53 2009 -0400

    [ring] Fix brokenness with macro implementation

 src/ring.h |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/ring.h b/src/ring.h
index a990e86..22af42f 100644
--- a/src/ring.h
+++ b/src/ring.h
@@ -97,8 +97,6 @@ typedef struct _VteRowData {
 
 
 #define _vte_row_data_get(__row, __col)			((const vtecell *) _vte_row_data_get_writable (__row, __col))
-#define _vte_row_data_get_writable(__row, __col)	(G_UNLIKELY ((__row)->_cells->len <= (unsigned int) __col) ? NULL : \
-							 &g_array_index (__row->_cells, vtecell, __col))
 #define _vte_row_data_length(__row)			((__row)->_cells->len + 0)
 #define _vte_row_data_insert(__row, __pos, __cell)	g_array_insert_val ((__row)->_cells, __pos, *(__cell))
 #define _vte_row_data_append(__row, __cell)		g_array_append_val ((__row)->_cells, *(__cell))
@@ -111,9 +109,17 @@ typedef struct _VteRowData {
 
 #define _vte_row_data_shrink(__row, __max_len)		g_array_set_size ((__row)->_cells, MIN((__row)->_cells->len, (unsigned int)(__max_len)))
 
+static inline vtecell *
+_vte_row_data_get_writable (VteRowData *row, unsigned int col)
+{
+	if (G_UNLIKELY (row->_cells->len <= col))
+		return NULL;
+
+	return &g_array_index (row->_cells, vtecell, col);
+}
+
 #if 0
 const vtecell *_vte_row_data_get (VteRowData *row, unsigned int col);
-vtecell *_vte_row_data_get_writable (VteRowData *row, unsigned int col);
 unsigned int _vte_row_data_length (VteRowData *row);
 void _vte_row_data_insert (VteRowData *row, int pos, const vtecell *cell);
 void _vte_row_data_append (VteRowData *row, const vtecell *cell);
@@ -123,7 +129,6 @@ void _vte_row_data_shrink (VteRowData *row, int max_len);
 #endif
 
 
-
 typedef struct _VteRing VteRing;
 
 struct _VteRing {



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