[gnumeric] colrow: use slice allocator, not g_new.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] colrow: use slice allocator, not g_new.
- Date: Thu, 10 Mar 2011 20:32:02 +0000 (UTC)
commit b338352bdb2b8eaebe0690abfcade62b4f4da985
Author: Morten Welinder <terra gnome org>
Date: Thu Mar 10 15:31:42 2011 -0500
colrow: use slice allocator, not g_new.
ChangeLog | 3 +++
src/colrow.c | 12 ++++++++++++
src/colrow.h | 3 ++-
src/sheet.c | 6 ++++--
4 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5d4a506..3b5eb55 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,10 @@
2011-03-10 Morten Welinder <terra gnome org>
+ * src/colrow.c (colrow_new, colrow_free): New functions.
+
* src/sheet.c (cell_new, cell_free): Use slice allocator, not
g_new.
+ (sheet_row_new, sheet_col_new): Use colrow_new.
2011-03-08 Andreas J. Guelzow <aguelzow pyrshep ca>
diff --git a/src/colrow.c b/src/colrow.c
index 753d237..9159e60 100644
--- a/src/colrow.c
+++ b/src/colrow.c
@@ -142,6 +142,18 @@ colrow_copy (ColRowInfo *dst, ColRowInfo const *src)
dst->visible = src->visible;
}
+ColRowInfo *
+colrow_new (void)
+{
+ return g_slice_new (ColRowInfo);
+}
+
+void
+colrow_free (ColRowInfo *cri)
+{
+ g_slice_free1 (sizeof (*cri), cri);
+}
+
/**
* colrow_foreach:
* @sheet the sheet
diff --git a/src/colrow.h b/src/colrow.h
index f07b2c0..b9f6f01 100644
--- a/src/colrow.h
+++ b/src/colrow.h
@@ -78,7 +78,8 @@ gboolean colrow_is_default (ColRowInfo const *cri);
gboolean colrow_is_empty (ColRowInfo const *cri);
gboolean colrow_equal (ColRowInfo const *a, ColRowInfo const *b);
void colrow_copy (ColRowInfo *dst, ColRowInfo const *src);
-#define colrow_free g_free
+ColRowInfo *colrow_new (void);
+void colrow_free (ColRowInfo *cri);
typedef struct {
int pos;
diff --git a/src/sheet.c b/src/sheet.c
index 65bba03..98b4d7a 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -1565,10 +1565,11 @@ sheet_apply_border (Sheet *sheet,
static ColRowInfo *
sheet_row_new (Sheet *sheet)
{
- ColRowInfo *ri = g_new (ColRowInfo, 1);
+ ColRowInfo *ri;
g_return_val_if_fail (IS_SHEET (sheet), NULL);
+ ri = colrow_new ();
*ri = sheet->rows.default_style;
ri->is_default = FALSE;
ri->needs_respan = TRUE;
@@ -1579,10 +1580,11 @@ sheet_row_new (Sheet *sheet)
static ColRowInfo *
sheet_col_new (Sheet *sheet)
{
- ColRowInfo *ci = g_new (ColRowInfo, 1);
+ ColRowInfo *ci;
g_return_val_if_fail (IS_SHEET (sheet), NULL);
+ ci = colrow_new ();
*ci = sheet->cols.default_style;
ci->is_default = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]