From b96599ccf353e89f95aa106853fcf310203c5874 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Sat, 15 Sep 2012 13:58:45 -0400 Subject: [PATCH] _pixman_implementation_create(): Initialize implementation with memset() All the function pointers are NULL by default now, so we can just zero the struct. Also write the function a little more compactly. --- pixman/pixman-implementation.c | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/pixman/pixman-implementation.c b/pixman/pixman-implementation.c index 1da9d82..f371172 100644 --- a/pixman/pixman-implementation.c +++ b/pixman/pixman-implementation.c @@ -31,35 +31,22 @@ pixman_implementation_t * _pixman_implementation_create (pixman_implementation_t *delegate, const pixman_fast_path_t *fast_paths) { - pixman_implementation_t *imp = malloc (sizeof (pixman_implementation_t)); - pixman_implementation_t *d; - int i; - - if (!imp) - return NULL; + pixman_implementation_t *imp; assert (fast_paths); - /* Make sure the whole delegate chain has the right toplevel */ - imp->delegate = delegate; - for (d = imp; d != NULL; d = d->delegate) - d->toplevel = imp; - - /* Fill out function pointers with ones that just delegate - */ - imp->blt = NULL; - imp->fill = NULL; - imp->src_iter_init = NULL; - imp->dest_iter_init = NULL; + if ((imp = malloc (sizeof (pixman_implementation_t)))) + { + pixman_implementation_t *d; - imp->fast_paths = fast_paths; + memset (imp, 0, sizeof *imp); - for (i = 0; i < PIXMAN_N_OPERATORS; ++i) - { - imp->combine_32[i] = NULL; - imp->combine_64[i] = NULL; - imp->combine_32_ca[i] = NULL; - imp->combine_64_ca[i] = NULL; + imp->delegate = delegate; + imp->fast_paths = fast_paths; + + /* Make sure the whole delegate chain has the right toplevel */ + for (d = imp; d != NULL; d = d->delegate) + d->toplevel = imp; } return imp; -- 2.7.4