From 474ea510387144f524e2cf5e2b2140900f88155c Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Mon, 21 Mar 2011 12:43:18 +0100 Subject: Use memset(ptr, 0, sizeof(struct)) instead of manually setting function pointers to NULL --- src/uca-cam.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'src/uca-cam.c') diff --git a/src/uca-cam.c b/src/uca-cam.c index b26b826..7b80f56 100644 --- a/src/uca-cam.c +++ b/src/uca-cam.c @@ -1,5 +1,6 @@ #include +#include #include "uca.h" #include "uca-cam.h" #include "uca-grabber.h" @@ -23,27 +24,11 @@ struct uca_camera *uca_cam_new(void) { struct uca_camera *cam = (struct uca_camera *) malloc(sizeof(struct uca_camera)); - cam->next = NULL; - /* Set all function pointers to NULL so we know early on, if something has * not been implemented. */ - cam->set_property = NULL; - cam->get_property = NULL; - cam->start_recording = NULL; - cam->stop_recording = NULL; - cam->grab = NULL; - cam->register_callback = NULL; - cam->destroy = NULL; - - cam->user = NULL; + memset(cam, 0, sizeof(struct uca_camera)); - cam->grabber = NULL; cam->state = UCA_CAM_CONFIGURABLE; cam->current_frame = 0; - - /* No callbacks and user data associated yet */ - cam->callback = NULL; - cam->callback_user = NULL; - return cam; } -- cgit v1.2.3