From 2b087cb45ae91f90492a935625570d7d42ee3ecb Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 7 Apr 2010 14:26:15 -0400 Subject: 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. --- libdimension/sphere.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'libdimension/sphere.c') diff --git a/libdimension/sphere.c b/libdimension/sphere.c index 7c2894b..77fd1d4 100644 --- a/libdimension/sphere.c +++ b/libdimension/sphere.c @@ -19,7 +19,6 @@ *************************************************************************/ #include "dimension.h" -#include /* For malloc */ #include /* For sqrt */ /* @@ -39,12 +38,10 @@ dmnsn_object * dmnsn_new_sphere() { dmnsn_object *sphere = dmnsn_new_object(); - if (sphere) { - sphere->intersection_fn = &dmnsn_sphere_intersection_fn; - sphere->inside_fn = &dmnsn_sphere_inside_fn; - sphere->bounding_box.min = dmnsn_new_vector(-1.0, -1.0, -1.0); - sphere->bounding_box.max = dmnsn_new_vector(1.0, 1.0, 1.0); - } + sphere->intersection_fn = &dmnsn_sphere_intersection_fn; + sphere->inside_fn = &dmnsn_sphere_inside_fn; + sphere->bounding_box.min = dmnsn_new_vector(-1.0, -1.0, -1.0); + sphere->bounding_box.max = dmnsn_new_vector(1.0, 1.0, 1.0); return sphere; } -- cgit v1.2.3