summaryrefslogtreecommitdiffstats
path: root/libdimension/diffuse.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension/diffuse.c')
-rw-r--r--libdimension/diffuse.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/libdimension/diffuse.c b/libdimension/diffuse.c
index d6ecf37..dc41944 100644
--- a/libdimension/diffuse.c
+++ b/libdimension/diffuse.c
@@ -20,7 +20,6 @@
#include "dimension.h"
#include <errno.h>
-#include <stdlib.h> /* For malloc */
#include <math.h>
/*
@@ -45,19 +44,13 @@ dmnsn_finish *
dmnsn_new_diffuse_finish(double diffuse)
{
dmnsn_finish *finish = dmnsn_new_finish();
- if (finish) {
- double *param = malloc(sizeof(double));
- if (!param) {
- dmnsn_delete_finish(finish);
- errno = ENOMEM;
- return NULL;
- }
- *param = diffuse;
+ double *param = dmnsn_malloc(sizeof(double));
+ *param = diffuse;
+
+ finish->ptr = param;
+ finish->diffuse_fn = &dmnsn_diffuse_finish_fn;
+ finish->free_fn = &free;
- finish->ptr = param;
- finish->diffuse_fn = &dmnsn_diffuse_finish_fn;
- finish->free_fn = &free;
- }
return finish;
}