summaryrefslogtreecommitdiffstats
path: root/libdimension/point_light.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension/point_light.c')
-rw-r--r--libdimension/point_light.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/libdimension/point_light.c b/libdimension/point_light.c
index 1ca3c96..02ab2ea 100644
--- a/libdimension/point_light.c
+++ b/libdimension/point_light.c
@@ -35,20 +35,14 @@ dmnsn_light *
dmnsn_new_point_light(dmnsn_vector x0, dmnsn_color color)
{
dmnsn_light *light = dmnsn_new_light();
- if (light) {
- /* Allocate room for the transformation matrix */
- dmnsn_color *ptr = malloc(sizeof(dmnsn_color));
- if (!ptr) {
- dmnsn_delete_light(light);
- errno = ENOMEM;
- return NULL;
- }
- *ptr = color;
- light->x0 = x0;
- light->light_fn = &dmnsn_point_light_fn;
- light->free_fn = &free;
- light->ptr = ptr;
- }
+ dmnsn_color *ptr = dmnsn_malloc(sizeof(dmnsn_color));
+ *ptr = color;
+
+ light->x0 = x0;
+ light->light_fn = &dmnsn_point_light_fn;
+ light->free_fn = &free;
+ light->ptr = ptr;
+
return light;
}