Esempio n. 1
0
static inline avl_node_t *
new_avl_node (avl_tree_t *tree, void *user_data)
{
    avl_node_t *node = CHUNK_ALLOC(tree, sizeof(avl_node_t));

    if (node) {
        node->parent = node->left = node->right = NULL;
        node->balance = 0;
        node->user_data = user_data;
        tree->n++;
    }
    return node;
}
Esempio n. 2
0
GnmCellCopy *
gnm_cell_copy_new (GnmCellRegion *cr, int col_offset, int row_offset)
{
	GnmCellCopy *res = CHUNK_ALLOC (GnmCellCopy, cell_copy_pool);
	((GnmCellPos *)(&res->offset))->col = col_offset;
	((GnmCellPos *)(&res->offset))->row = row_offset;
	res->texpr = NULL;
	res->val = NULL;

	if (NULL == cr->cell_content)
		cr->cell_content = g_hash_table_new_full (
			(GHashFunc)&gnm_cellpos_hash,
			(GCompareFunc)&gnm_cellpos_equal,
			(GDestroyNotify) gnm_cell_copy_free,
			NULL);

	g_hash_table_insert (cr->cell_content, res, res);

	return res;
}