diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-04-07 14:26:15 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-04-07 14:34:52 -0400 |
commit | 2b087cb45ae91f90492a935625570d7d42ee3ecb (patch) | |
tree | a464213b08d04c8c91c8879a84e534f895c84378 /libdimension/camera.c | |
parent | 7d6663eeb68bf9d0a3dff86128827c0c1d85df69 (diff) | |
download | dimension-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/camera.c')
-rw-r--r-- | libdimension/camera.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/libdimension/camera.c b/libdimension/camera.c index eeb399c..9d30731 100644 --- a/libdimension/camera.c +++ b/libdimension/camera.c @@ -20,18 +20,13 @@ #include "dimension.h" #include <errno.h> -#include <stdlib.h> /* For malloc */ /* Allocate a new dummy camera */ dmnsn_camera * dmnsn_new_camera() { - dmnsn_camera *camera = malloc(sizeof(dmnsn_camera)); - if (camera) { - camera->free_fn = NULL; - } else { - errno = ENOMEM; - } + dmnsn_camera *camera = dmnsn_malloc(sizeof(dmnsn_camera)); + camera->free_fn = NULL; return camera; } |