diff options
| author | Jakub Hrozek <jhrozek@redhat.com> | 2009-09-17 16:04:45 +0200 |
|---|---|---|
| committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-09-21 11:44:51 -0400 |
| commit | c8afa2d4bd5ecd6cf5f4dc5d0cbedb9470ce848a (patch) | |
| tree | a75b3f812038497bcad944f0bc3879272b9e6717 /elapi/elapi_sink.c | |
| parent | c5a0363437783d27140bd359ce59f5a92a879d07 (diff) | |
ELAPI: Ticket 161: Initialize structures with calloc instead of enumerating members
Diffstat (limited to 'elapi/elapi_sink.c')
| -rw-r--r-- | elapi/elapi_sink.c | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/elapi/elapi_sink.c b/elapi/elapi_sink.c index 46ddadd..0e2712f 100644 --- a/elapi/elapi_sink.c +++ b/elapi/elapi_sink.c @@ -432,28 +432,12 @@ int elapi_sink_create(struct elapi_sink_ctx **sink_ctx, TRACE_FLOW_STRING("elapi_sink_create", "Entry point"); /* Allocate context */ - sink_context = (struct elapi_sink_ctx *)malloc(sizeof(struct elapi_sink_ctx)); + sink_context = (struct elapi_sink_ctx *)calloc(1, sizeof(struct elapi_sink_ctx)); if (sink_context == NULL) { TRACE_ERROR_NUMBER("Memory allocation failed. Error", ENOMEM); return ENOMEM; } - /* Initialize the allocatable items so that we can call destroy function - * in case of error. - * FIXME - add initialization here for other elements as they are added. - */ - - sink_context->async_mode = 0; - sink_context->in_queue = NULL; - sink_context->pending = NULL; - sink_context->sink_cfg.provider = NULL; - sink_context->sink_cfg.priv_ctx = NULL; - sink_context->sink_cfg.libhandle = NULL; - sink_context->sink_cfg.ability = NULL; - sink_context->sink_cfg.cpb_cb.init_cb = NULL; - sink_context->sink_cfg.cpb_cb.submit_cb = NULL; - sink_context->sink_cfg.cpb_cb.close_cb = NULL; - /* Read common fields */ error = elapi_read_sink_cfg(&(sink_context->sink_cfg), name, ini_config); |
