summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-03-21 12:43:18 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-03-21 12:43:18 +0100
commit474ea510387144f524e2cf5e2b2140900f88155c (patch)
tree6e540f15d3526a7330fb7faa9ad8f7f2d9bae88b /src
parent195ead4d9aa4f1ed244558d49cee348a5ae6e939 (diff)
downloadlibuca-474ea510387144f524e2cf5e2b2140900f88155c.tar.gz
libuca-474ea510387144f524e2cf5e2b2140900f88155c.tar.bz2
libuca-474ea510387144f524e2cf5e2b2140900f88155c.tar.xz
libuca-474ea510387144f524e2cf5e2b2140900f88155c.zip
Use memset(ptr, 0, sizeof(struct)) instead of manually setting function pointers
to NULL
Diffstat (limited to 'src')
-rw-r--r--src/grabbers/me4.c9
-rw-r--r--src/uca-cam.c19
2 files changed, 5 insertions, 23 deletions
diff --git a/src/grabbers/me4.c b/src/grabbers/me4.c
index 42632af..874df32 100644
--- a/src/grabbers/me4.c
+++ b/src/grabbers/me4.c
@@ -191,13 +191,11 @@ uint32_t uca_me4_init(struct uca_grabber **grabber)
return UCA_ERR_GRABBER_NOT_FOUND;
struct uca_grabber *uca = (struct uca_grabber *) malloc(sizeof(struct uca_grabber));
- struct fg_apc_data *me4 = (struct fg_apc_data *) malloc(sizeof(struct fg_apc_data));
+ memset(uca, 0, sizeof(struct uca_grabber));
+ struct fg_apc_data *me4 = (struct fg_apc_data *) malloc(sizeof(struct fg_apc_data));
+ memset(me4, 0, sizeof(struct fg_apc_data));
me4->fg = fg;
- me4->mem = NULL;
- me4->callback = NULL;
- me4->meta_data = NULL;
- me4->user = NULL;
uca->user = me4;
uca->destroy = &uca_me4_destroy;
@@ -208,7 +206,6 @@ uint32_t uca_me4_init(struct uca_grabber **grabber)
uca->stop_acquire = &uca_me4_stop_acquire;
uca->grab = &uca_me4_grab;
uca->register_callback = &uca_me4_register_callback;
- uca->callback = NULL;
*grabber = uca;
return UCA_NO_ERROR;
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 <stdlib.h>
+#include <string.h>
#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;
}