Commit b338352b authored by Morten Welinder's avatar Morten Welinder

colrow: use slice allocator, not g_new.

parent de427584
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>
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment