>From 4c94e4c928ea5aaacb72481f6b5e36fe64626e5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Thu, 16 Dec 2010 23:54:43 +0100 Subject: [PATCH 1/3] Replace useless init with a call to calloc --- src/common.c | 42 +----------------------------------------- 1 files changed, 1 insertions(+), 41 deletions(-) diff --git a/src/common.c b/src/common.c index 7bc1215..7f531f2 100644 --- a/src/common.c +++ b/src/common.c @@ -33,47 +33,7 @@ fsdp_description_t* fsdp_description_new(void) { - unsigned int i; - fsdp_description_t *result = malloc(sizeof(fsdp_description_t)); - - result->version = 0; - result->o_username = result->o_session_id = - result->o_announcement_version = NULL; - result->o_network_type = FSDP_NETWORK_TYPE_UNDEFINED; - result->o_address_type = FSDP_ADDRESS_TYPE_UNDEFINED; - result->o_address = NULL; - result->s_name = NULL; - result->i_information = NULL; - result->u_uri = NULL; - result->emails = NULL; - result->emails_count = 0; - result->phones = NULL; - result->phones_count = 0; - /* At first, there is no session-level definition for these - parameters */ - result->c_network_type = FSDP_NETWORK_TYPE_UNDEFINED; - result->c_address_type = FSDP_ADDRESS_TYPE_UNDEFINED; - result->c_address.address = NULL; - /* there is no session-level definition for these parameters */ - result->bw_modifiers = NULL; - result->bw_modifiers_count = 0; - result->time_periods = NULL; - result->time_periods_count = 0; - result->timezone_adj = NULL; - result->k_encryption_method = FSDP_ENCRYPTION_METHOD_UNDEFINED; - result->k_encryption_content = NULL; - /* Default/undefined values for attributes */ - for ( i = 0; i < (FSDP_LAST_SESSION_STR_ATT + 1); i++ ) - result->a_str_attributes[i] = NULL; - result->a_type = FSDP_SESSION_TYPE_UNDEFINED; - result->a_sendrecv_mode = FSDP_SENDRECV_UNDEFINED; - result->a_sdplangs = result->a_langs = NULL; - result->a_rtpmaps = NULL; - result->unidentified_attributes = NULL; - result->unidentified_attributes_count = 0; - result->media_announcements = NULL; - result->media_announcements_count = 0; - + fsdp_description_t *result = calloc(*result); return result; } -- 1.7.3.3