From 021cb2c3870b9d0b2f2e03416702fc561f160c2b Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 25 Apr 2016 11:28:49 +0200 Subject: mp_image: allow passing NULL to mp_image_new_custom_ref() A minor simplification. Most callers don't need this, and there's no good reason why the caller should provide an "initializer" like this. (This function calls mp_image_new_dummy_ref(), which has no reason for an initializer either.) --- video/mp_image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'video/mp_image.c') diff --git a/video/mp_image.c b/video/mp_image.c index 0ca59c62c9..5adce213e5 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -230,7 +230,7 @@ struct mp_image *mp_image_new_dummy_ref(struct mp_image *img) { struct mp_image *new = talloc_ptrtype(NULL, new); talloc_set_destructor(new, mp_image_destructor); - *new = *img; + *new = img ? *img : (struct mp_image){0}; for (int p = 0; p < MP_MAX_PLANES; p++) new->bufs[p] = NULL; new->hwctx = NULL; -- cgit v1.2.3