ref: bf8d64004d1f830a8e739a9d0a69781d7a393665
parent: 1aaa5836b917805a63d054a18b29a199f1993ad8
author: Luc Trudeau <[email protected]>
date: Tue Mar 24 13:52:55 EDT 2020
Clean up dav1d_ref_create
--- a/src/ref.c
+++ b/src/ref.c
@@ -37,18 +37,14 @@
}
Dav1dRef *dav1d_ref_create(const size_t size) {
- Dav1dRef *res;
void *data = dav1d_alloc_aligned(size, 32);
- if (!data) {
- return NULL;
- }
+ if (!data) return NULL;
- res = dav1d_ref_wrap(data, default_free_callback, data);
- if (!res) {
- dav1d_free_aligned(data);
- } else {
+ Dav1dRef *const res = dav1d_ref_wrap(data, default_free_callback, data);
+ if (res)
res->data = data;
- }
+ else
+ dav1d_free_aligned(data);
return res;
}
@@ -55,7 +51,7 @@
Dav1dRef *dav1d_ref_wrap(const uint8_t *const ptr,
void (*free_callback)(const uint8_t *data, void *user_data),
- void *user_data)
+ void *const user_data)
{
Dav1dRef *res = malloc(sizeof(Dav1dRef));
if (!res) return NULL;