summaryrefslogtreecommitdiffstats
path: root/libdimension/bvst.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-04-07 14:26:15 -0400
committerTavian Barnes <tavianator@gmail.com>2010-04-07 14:34:52 -0400
commit2b087cb45ae91f90492a935625570d7d42ee3ecb (patch)
treea464213b08d04c8c91c8879a84e534f895c84378 /libdimension/bvst.c
parent7d6663eeb68bf9d0a3dff86128827c0c1d85df69 (diff)
downloaddimension-2b087cb45ae91f90492a935625570d7d42ee3ecb.tar.xz
New dmnsn_malloc() function, and friends.
I'm tired of checking for malloc failures everywhere, considering it never happens. So just bail out whenever it does. A lot of stuff is guaranteed to succeed if it returns now.
Diffstat (limited to 'libdimension/bvst.c')
-rw-r--r--libdimension/bvst.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/libdimension/bvst.c b/libdimension/bvst.c
index 6e23d6d..958273d 100644
--- a/libdimension/bvst.c
+++ b/libdimension/bvst.c
@@ -25,22 +25,15 @@
dmnsn_bvst *
dmnsn_new_bvst()
{
- dmnsn_bvst *tree = malloc(sizeof(dmnsn_bvst));
- if (tree) {
- tree->root = NULL;
- } else {
- dmnsn_error(DMNSN_SEVERITY_HIGH, "BVST allocation failed.");
- }
+ dmnsn_bvst *tree = dmnsn_malloc(sizeof(dmnsn_bvst));
+ tree->root = NULL;
return tree;
}
static dmnsn_bvst_node *
dmnsn_new_bvst_node()
{
- dmnsn_bvst_node *node = malloc(sizeof(dmnsn_bvst_node));
- if (!node) {
- dmnsn_error(DMNSN_SEVERITY_HIGH, "BVST node allocation failed.");
- }
+ dmnsn_bvst_node *node = dmnsn_malloc(sizeof(dmnsn_bvst_node));
return node;
}