[evolution-kolab/gnome-2-30] libekolabconv: ISO C90 forbids mixed declarations and code



commit 8a4e3bc1fab379716569b1b2d1a2625859c9542c
Author: Christian Hilberg <hilberg kernelconcepts de>
Date:   Wed Nov 16 20:13:22 2011 +0100

    libekolabconv: ISO C90 forbids mixed declarations and code
    
    * fixed various occasions of mixed declarations and code
    * minor cleanups

 .../main/src/evolution/contact-e-to-i.c            |   83 ++++++---
 .../main/src/evolution/contact-i-to-e.c            |   23 ++-
 .../main/src/evolution/event-e-to-i.c              |   14 +-
 .../main/src/evolution/event-i-to-e.c              |   10 +-
 .../main/src/evolution/evolution-util.c            |   12 +-
 src/libekolabconv/main/src/evolution/note-e-to-i.c |    7 +-
 src/libekolabconv/main/src/evolution/note-i-to-e.c |   13 +-
 .../main/src/evolution/priv-common-e-to-i.c        |   44 +++--
 .../main/src/evolution/priv-common-i-to-e.c        |   22 ++-
 .../main/src/evolution/priv-evolution-preserve.c   |   28 ++-
 .../main/src/evolution/priv-incidence-e-to-i.c     |   55 ++++--
 .../main/src/evolution/priv-incidence-i-to-e.c     |   34 ++--
 src/libekolabconv/main/src/evolution/task-e-to-i.c |   18 ++-
 src/libekolabconv/main/src/evolution/task-i-to-e.c |   10 +-
 src/libekolabconv/main/src/kolab-conv.c            |   48 +++--
 src/libekolabconv/main/src/kolab/contact-i-to-k.c  |    7 +-
 src/libekolabconv/main/src/kolab/contact-k-to-i.c  |   78 +++++---
 src/libekolabconv/main/src/kolab/event-i-to-k.c    |   14 +-
 src/libekolabconv/main/src/kolab/event-k-to-i.c    |   16 +-
 src/libekolabconv/main/src/kolab/kolab-util.c      |   73 ++++---
 src/libekolabconv/main/src/kolab/note-i-to-k.c     |    4 +-
 src/libekolabconv/main/src/kolab/note-k-to-i.c     |    9 +-
 .../main/src/kolab/priv-common-i-to-k.c            |    4 +-
 .../main/src/kolab/priv-common-k-to-i.c            |   12 +-
 .../main/src/kolab/priv-incidence-i-to-k.c         |   38 +++--
 .../main/src/kolab/priv-incidence-k-to-i.c         |   36 +++-
 .../main/src/kolab/priv-kolab-preserve.c           |    9 +-
 src/libekolabconv/main/src/kolab/task-i-to-k.c     |    6 +-
 src/libekolabconv/main/src/kolab/task-k-to-i.c     |   22 ++-
 src/libekolabconv/main/src/structs/common.c        |    4 +-
 src/libekolabconv/main/src/util.c                  |    4 +-
 src/libekolabconv/test/src/email-parser.c          |   17 +-
 src/libekolabconv/test/src/main.c                  |    8 +-
 src/libekolabconv/test/src/test-evolution-event.c  |   16 +-
 src/libekolabconv/test/src/test-kolab-contact.c    |   18 +-
 src/libekolabconv/test/src/test-kolab-event.c      |  157 ++++++++++-----
 src/libekolabconv/test/src/test-kolab-note.c       |    3 +-
 src/libekolabconv/test/src/test-kolab-task.c       |  121 ++++++++----
 src/libekolabconv/test/src/test-util.c             |   75 +++++---
 src/libekolabconv/test/src/testbase.c              |  202 +++++++++++++-------
 40 files changed, 888 insertions(+), 486 deletions(-)
---
diff --git a/src/libekolabconv/main/src/evolution/contact-e-to-i.c b/src/libekolabconv/main/src/evolution/contact-e-to-i.c
index a28a95f..86c5621 100644
--- a/src/libekolabconv/main/src/evolution/contact-e-to-i.c
+++ b/src/libekolabconv/main/src/evolution/contact-e-to-i.c
@@ -64,10 +64,12 @@ static Icontact_phone_type phone_type_e_to_i(GList *vcard_types);
 I_contact*
 conv_EContact_to_I_contact (const EContact* e_contact, GError** error)
 {
+	I_contact *i_contact = NULL;
+	
 	g_assert(error != NULL && *error == NULL);
 	log_debug ("\nconv_EContact_to_I_contact(): convert EContact to I_contact struct.");
 
-	I_contact *i_contact = new_i_contact ();
+	i_contact = new_i_contact ();
 
 	if (e_contact) {
 		process_contact_e_to_i (i_contact, e_contact);
@@ -111,9 +113,15 @@ process_contact_e_to_i (I_contact* i_contact, const EContact *e_contact)
 	gchar *buffer;
 
 	if (e_contact_dup != NULL) {
+		GHashTable *kstore_hash = NULL;
+		gchar *nick_name = NULL;
+		gchar *full_name = NULL;
+		EVCardAttribute *attribute = NULL;
+		gchar *value = NULL;
+		
 		log_debug("read kolab store information");
 
-		GHashTable *kstore_hash = kolab_store_read_values (e_contact_dup, i_contact);
+		kstore_hash = kolab_store_read_values (e_contact_dup, i_contact);
 
 		log_debug("process birth date");
 		/* e_contact_get              (EContact *contact, EContactField field_id); */
@@ -171,12 +179,12 @@ process_contact_e_to_i (I_contact* i_contact, const EContact *e_contact)
 
 		e_contact_name_free(name);
 
-		gchar *nick_name = e_contact_get (e_contact_dup, E_CONTACT_NICKNAME);
+		nick_name = e_contact_get (e_contact_dup, E_CONTACT_NICKNAME);
 		if (is_not_empty(nick_name))
 			i_contact->nick_name = g_string_new (nick_name);
 		g_free(nick_name);
 
-		gchar *full_name = e_contact_get (e_contact_dup, E_CONTACT_FULL_NAME);
+		full_name = e_contact_get (e_contact_dup, E_CONTACT_FULL_NAME);
 		if (is_not_empty(full_name))
 			i_contact->full_name = g_string_new (full_name);
 		g_free(full_name);
@@ -282,12 +290,15 @@ process_contact_e_to_i (I_contact* i_contact, const EContact *e_contact)
 		g_free(buffer);
 		buffer = e_contact_get (e_contact_dup, E_CONTACT_REV);
 		if (buffer) {
+			struct tm *t = NULL;
+			time_t *tt = NULL;
+			
 			if (buffer[10] == 'T') /* get rid of 'T' in iso time stamp if neccessary */
 			        buffer[10] = ' ';
 
-			struct tm *t = g_new0(struct tm, 1);
+			t = g_new0(struct tm, 1);
 			strptime(buffer, "%Y-%m-%d %H:%M:%S", t);
-			time_t *tt = g_new0(time_t, 1);
+			tt = g_new0(time_t, 1);
 			*tt = time_gm(t);
 			g_free(t);
 			i_contact->common->last_modified_datetime = g_new0(Date_or_datetime, 1);
@@ -299,18 +310,20 @@ process_contact_e_to_i (I_contact* i_contact, const EContact *e_contact)
 			*i_contact->common->last_modified_datetime->date_time = time(0);
 		}
 		buffer = NULL;
-		EVCardAttribute *attribute = e_vcard_get_attribute((EVCard *) e_contact_dup, ICONTACT_KOLAB_CREATED);
-		gchar *value = NULL;
+		attribute = e_vcard_get_attribute((EVCard *) e_contact_dup, ICONTACT_KOLAB_CREATED);
 		if(attribute)
 			value = e_vcard_attribute_get_value (attribute);
 
 		if (attribute && value) {
+			struct tm *t2 = NULL;
+			time_t *tt2 = NULL;
+			
 			if (value[10] == 'T') /* get rid of 'T' in iso time stamp if neccessary */
 				value[10] = ' ';
 
-			struct tm *t2 = g_new0(struct tm, 1);
+			t2 = g_new0(struct tm, 1);
 			strptime (value, "%Y-%m-%d %H:%M:%S", t2);
-			time_t *tt2 = g_new0(time_t, 1);
+			tt2 = g_new0(time_t, 1);
 			*tt2 = time_gm (t2);
 			g_free(t2);
 			i_contact->common->creation_datetime = new_date_or_datetime();
@@ -330,6 +343,8 @@ process_contact_e_to_i (I_contact* i_contact, const EContact *e_contact)
 		e_contact_photo = e_contact_get (e_contact_dup, E_CONTACT_PHOTO);
 
 		if (e_contact_photo && e_contact_photo->type == E_CONTACT_PHOTO_TYPE_INLINED) {
+			gchar *d = NULL;
+			
 			/* Bin_attachment *photo; */
 			/* photo = (Bin_attachment *) malloc ( sizeof(Bin_attachment) ); */
 			i_contact->photo = g_new0(Kolab_conv_mail_part, 1);
@@ -338,7 +353,7 @@ process_contact_e_to_i (I_contact* i_contact, const EContact *e_contact)
 			i_contact->photo->data = g_new0(gchar, i_contact->photo->length);
 
 			/* handle mime type */
-			gchar *d = (gchar*) e_contact_photo->data.inlined.data;
+			d = (gchar*) e_contact_photo->data.inlined.data;
 
 			/* JPEG SOI marker (first two bytes): FF D8 */
 			if (memcmp (d, "\xFF\xD8", 2) == 0) {
@@ -449,6 +464,8 @@ add_phone_numbers (const EContact *e_contact, I_contact* i_contact, GHashTable *
 		/* do if it is a phone object */
 		if (!strcmp (EVC_TEL, e_vcard_attribute_get_name (a)))
 		{
+			gchar* value = NULL;
+			
 			GList *params = e_vcard_attribute_get_param (a, EVC_TYPE);
 			GList *param;
 			GList *type_list = NULL;
@@ -459,7 +476,7 @@ add_phone_numbers (const EContact *e_contact, I_contact* i_contact, GHashTable *
 			}
 
 			/* phone number */
-			gchar* value = e_vcard_attribute_get_value(a);
+			value = e_vcard_attribute_get_value(a);
 
 			if (value != NULL) {
 				Phone_number *phone_nr = g_new0(Phone_number, 1);
@@ -481,12 +498,14 @@ add_phone_numbers (const EContact *e_contact, I_contact* i_contact, GHashTable *
 						EVCardAttributeParam *eparam = paramlist->data;
 
 						if (eparam != NULL) {
+							GList* xml_str_list = NULL;
+							
 							gchar *id_str = (gchar*)eparam;
 							gint id = strtol(id_str, (gchar**)0, 10);
 							gint *id_ptr = g_new0(gint, 1);
 							log_debug("found kolab store id %d", id);
 							*id_ptr = id;
-							GList* xml_str_list = g_hash_table_lookup(k_store_hash, id_ptr);
+							xml_str_list = g_hash_table_lookup(k_store_hash, id_ptr);
 							g_free(id_ptr);
 							xml_str_list = g_list_last(xml_str_list);
 							for (;xml_str_list != NULL; xml_str_list = xml_str_list->prev) {
@@ -572,12 +591,13 @@ add_custom_fields (const EContact *e_contact, I_contact* i_contact, GHashTable *
 				EVCardAttributeParam *eparam = paramlist->data;
 
 				if (eparam != NULL) {
+					GList* xml_str_list = NULL;
 					gchar *id_str = (gchar*)eparam;
 					gint id = strtol(id_str, (gchar**)0, 10);
 					gint *id_ptr = g_new0(gint, 1);
 					log_debug("found kolab store id %d", id);
 					*id_ptr = id;
-					GList* xml_str_list = g_hash_table_lookup(k_store_hash, id_ptr);
+					xml_str_list = g_hash_table_lookup(k_store_hash, id_ptr);
 					g_free(id_ptr);
 					xml_str_list = g_list_last(xml_str_list);
 					for (;xml_str_list != NULL; xml_str_list = xml_str_list->prev) {
@@ -605,23 +625,29 @@ kolab_store_handle_attachments(const EContact *e_contact, I_common* icommon)
 	for (; list != NULL; list = list->next) {
 		EVCardAttribute *attrib = (EVCardAttribute*)list->data;
 		if (strcmp(e_vcard_attribute_get_name (attrib), ICONTACT_KOLAB_STORE_ATTACHMENT) == 0) {
+			GString *str = NULL;
+
 			Kolab_conv_mail_part *mpart = g_new0(Kolab_conv_mail_part, 1);
 			EVCardAttributeParam* param = NULL;
 			GList *params = e_vcard_attribute_get_params(attrib);
 			for (; params != NULL; params = params->next) {
 				if (strcmp(e_vcard_attribute_param_get_name (params->data), ICONTACT_KOLAB_STORE_ATTACHMENT_MTYPE)== 0) {
+					GList *vlist = NULL;
+					gchar *mime_type = NULL;
 					param = (EVCardAttributeParam*)params->data;
-					GList *vlist = e_vcard_attribute_param_get_values(param);
-					gchar *mime_type = g_strdup((gchar*)vlist->data);
+					vlist = e_vcard_attribute_param_get_values(param);
+					mime_type = g_strdup((gchar*)vlist->data);
 					mpart->mime_type = mime_type;
 				} else if (strcmp(e_vcard_attribute_param_get_name (params->data), ICONTACT_KOLAB_STORE_ATTACHMENT_NAME)== 0) {
+					GList *vlist = NULL;
+					gchar *name = NULL;
 					param = (EVCardAttributeParam*)params->data;
-					GList *vlist = e_vcard_attribute_param_get_values(param);
-					gchar *name = g_strdup((gchar*)vlist->data);
+					vlist = e_vcard_attribute_param_get_values(param);
+					name = g_strdup((gchar*)vlist->data);
 					mpart->name = name;
 				}
 			}
-			GString *str = e_vcard_attribute_get_value_decoded (attrib);
+			str = e_vcard_attribute_get_value_decoded (attrib);
 			mpart->data = str->str;
 			mpart->length = str->len;
 
@@ -650,11 +676,12 @@ kolab_store_read_values (const EContact *e_contact, I_contact* i_contact)
 		EVCardAttribute *attrib = (EVCardAttribute*)list->data;
 		if (strcmp(e_vcard_attribute_get_name (attrib), ICONTACT_KOLAB_STORE) == 0) {
 			EVCardAttributeParam* param = NULL;
+			GString *str = NULL;
 			GList *params = e_vcard_attribute_get_params(attrib);
 			for (; params != NULL; params = params->next)
 				if (strcmp(e_vcard_attribute_param_get_name (params->data), ICONTACT_KOLAB_STORE_ID)== 0)
 					param = (EVCardAttributeParam*)params->data;
-			GString *str = e_vcard_attribute_get_value_decoded (attrib);
+			str = e_vcard_attribute_get_value_decoded (attrib);
 			if (param == NULL) {
 				kolab_store_add_element(i_contact->common, i_contact->common, strdup(str->str), FALSE);
 			} else {
@@ -665,9 +692,10 @@ kolab_store_read_values (const EContact *e_contact, I_contact* i_contact)
 					if (id == KOLAB_STORE_PTR_CONTACT_NAME)
 						kolab_store_add_element(i_contact->common, (gpointer) KOLAB_STORE_PTR_CONTACT_NAME, strdup(str->str), FALSE);
 					else {
+						GList *xml_str_list = NULL;
 						gint *idptr = g_new0(gint, 1); /* pointer must be different every time */
 						*idptr = id;
-						GList *xml_str_list = g_hash_table_lookup(hash, idptr);
+						xml_str_list = g_hash_table_lookup(hash, idptr);
 						xml_str_list = g_list_append(xml_str_list, (gpointer) strdup(str->str));
 						g_hash_table_insert(hash, idptr, xml_str_list);
 					}
@@ -703,11 +731,15 @@ static void
 kolab_store_restore_subnode_xml(I_contact *i_contact, gpointer parent_ptr,
 		const EContact *e_contact, EContactField e_field, GHashTable *k_store_hash)
 {
+	gchar *e_value = NULL;
+	GList *e_attr_list = NULL;
+	
 	log_debug("get vcard attributes for econtact field");
 
-	gchar *e_value = e_contact_get ((EContact*) e_contact, e_field); /* params cannot be accessed here */
-	GList* e_attr_list = e_contact_get_attributes ((EContact*)e_contact, e_field); /* params can be accessed here but attribute set is bigger than before => use evalue to reduce attribute set. */
+	e_value = e_contact_get ((EContact*) e_contact, e_field); /* params cannot be accessed here */
+	e_attr_list = e_contact_get_attributes ((EContact*)e_contact, e_field); /* params can be accessed here but attribute set is bigger than before => use evalue to reduce attribute set. */
 	for (; e_attr_list != NULL; e_attr_list = e_attr_list->next) {
+		GList *eparams = NULL;
 		EVCardAttribute *eattr = (EVCardAttribute*) e_attr_list->data;
 		if (e_vcard_attribute_is_single_valued(eattr)) {
 			gchar *avalue = e_vcard_attribute_get_value (eattr);
@@ -719,19 +751,20 @@ kolab_store_restore_subnode_xml(I_contact *i_contact, gpointer parent_ptr,
 		}
 		/* log_debug("get vcard parameters for attribute %s", ((GString*)e_vcard_attribute_get_values_decoded(eattr)->data)->str); */
 		/* gchar *aname = e_vcard_attribute_get_name(eattr); no new string is created here */
-		GList *eparams = e_vcard_attribute_get_params (eattr);
+		eparams = e_vcard_attribute_get_params (eattr);
 		for (;eparams != NULL; eparams = eparams->next) {
 			if (strcmp(e_vcard_attribute_param_get_name (eparams->data), ICONTACT_KOLAB_STORE_ID) == 0) {
 				EVCardAttributeParam *eparam = eparams->data;
 				GList *epvlist = e_vcard_attribute_param_get_values(eparam);
 				if (epvlist != NULL) {
 					gchar *id_str = epvlist->data;
+					GList* xml_str_list = NULL;
 
 					gint id = strtol (id_str, (gchar**)0, 10);
 					gint *id_ptr = g_new0(gint, 1);
 					log_debug("found kolab store id %d", id);
 					*id_ptr = id;
-					GList* xml_str_list = g_hash_table_lookup(k_store_hash, id_ptr);
+					xml_str_list = g_hash_table_lookup(k_store_hash, id_ptr);
 					g_free(id_ptr);
 					xml_str_list = g_list_last(xml_str_list);
 					for (;xml_str_list != NULL; xml_str_list = xml_str_list->prev) {
diff --git a/src/libekolabconv/main/src/evolution/contact-i-to-e.c b/src/libekolabconv/main/src/evolution/contact-i-to-e.c
index 9884a9f..adb5cef 100644
--- a/src/libekolabconv/main/src/evolution/contact-i-to-e.c
+++ b/src/libekolabconv/main/src/evolution/contact-i-to-e.c
@@ -60,10 +60,12 @@ static EContactField address_type_i_to_e(Icontact_address_type i_addr_type);
 EContact*
 conv_I_contact_to_EContact (I_contact **icontact_ptr, GError** error)
 {
+	I_contact *icontact = NULL;
+	EContact* eContact = NULL;
+
 	log_debug ("\nconv_I_contact_to_EContact(): convert I_contact to EContact.");
 
-	I_contact *icontact = *icontact_ptr;
-	EContact* eContact = NULL;
+	icontact = *icontact_ptr;	
 	error = NULL;
 
 	if (icontact != NULL) {
@@ -96,6 +98,13 @@ process_contact_i_to_e (EContact* e_contact, I_contact **i_contact)
 	 */
 	GList *k_store_sublist = NULL;
 
+	EContactDate date;
+	GList* list = NULL;
+	Custom* custom_field = NULL;
+	/* char paramName[20], intStr[5]; for adding hidden field for kolab_store */
+	gint i = 0;
+	gint max_evolution_im = 4; /* maximum instant messenger fields that can be handled by evolution, rest in kolab store */
+	
 	/* *****************************************************************SET NAME******************************************* */
 	EContactName *name = g_new0(EContactName, 1);
 	if (icontact->given_name != NULL)
@@ -146,11 +155,6 @@ process_contact_i_to_e (EContact* e_contact, I_contact **i_contact)
 		e_contact_set (e_contact, E_CONTACT_OFFICE, icontact->office_location->str);
 
 	/* *****************************************************************SET BIRTHDAY*************************************** */
-	EContactDate date;
-	GList* list = NULL;
-	Custom * custom_field = NULL;
-	/* char paramName[20], intStr[5]; for adding hidden field for kolab_store */
-
 	if (icontact->birthday != NULL) {
 		date.day = icontact->birthday->day;
 		date.month = icontact->birthday->month;
@@ -215,7 +219,6 @@ process_contact_i_to_e (EContact* e_contact, I_contact **i_contact)
 	/* *****************************************************************SET EMAIL****************************************** */
 	list = NULL;
 	list = g_list_first (icontact->emails);
-	gint i = 0;
 
 	while (list != NULL && i < 4) {
 
@@ -317,12 +320,13 @@ process_contact_i_to_e (EContact* e_contact, I_contact **i_contact)
 		if (icontact->common->creation_datetime != NULL
 				&& icontact->common->creation_datetime->date_time != NULL) {
 
+			EVCardAttribute *createdAttribute = NULL;
 			struct tm *ts =	gmtime (icontact->common->creation_datetime->date_time);
 			gchar *buf = g_new0(gchar, 21);
 			strftime (buf, 21, "%Y-%m-%dT%H:%M:%SZ", ts);
 
 			/* Create a new vcard attribute */
-			EVCardAttribute *createdAttribute = e_vcard_attribute_new (NULL, ICONTACT_KOLAB_CREATED);
+			createdAttribute = e_vcard_attribute_new (NULL, ICONTACT_KOLAB_CREATED);
 
 			/* Add the vcard attribute to eContact */
 			e_vcard_add_attribute_with_value ((EVCard *) e_contact, createdAttribute, buf);
@@ -363,7 +367,6 @@ process_contact_i_to_e (EContact* e_contact, I_contact **i_contact)
 	list = NULL;
 	list = g_list_first (icontact->custom_list);
 	i = 0;					/* count for written messenger fields */
-	gint max_evolution_im = 4;		/* maximum instant messenger fields that can be handled by evolution, rest in kolab store */
 
 	while (list != NULL) {
 		custom_field = (Custom *) list->data;
diff --git a/src/libekolabconv/main/src/evolution/event-e-to-i.c b/src/libekolabconv/main/src/evolution/event-e-to-i.c
index 216f913..240f96e 100644
--- a/src/libekolabconv/main/src/evolution/event-e-to-i.c
+++ b/src/libekolabconv/main/src/evolution/event-e-to-i.c
@@ -40,9 +40,11 @@ static void process_event_e_to_i(const ECalComponentWithTZ *ectz, I_event *i_eve
 I_event*
 conv_ECalComponentWithTZ_to_I_event (const ECalComponentWithTZ *e_event, GError **error)
 {
+	I_event *ievent = NULL;
+
 	log_debug ("\nconv_ECalComponentWithTZ_to_I_event(): convert ECalcomponentWithTZ to I_event.");
 
-	I_event *ievent = new_i_event ();
+	ievent = new_i_event ();
 
 	if (e_event) {
 		process_event_e_to_i(e_event, ievent, error);
@@ -75,8 +77,12 @@ transparency_to_show_time_as(ECalComponentTransparency e_transp)
 static void
 process_event_e_to_i(const ECalComponentWithTZ *ectz, I_event *i_event, GError **error)
 {
+	ECalComponent *e_cal_comp = NULL;
+	ECalComponentTransparency *e_transp = NULL;
+	ECalComponentDateTime *e_end_date = NULL;
+	
 	g_assert(error != NULL && *error == NULL);
-	ECalComponent *e_cal_comp = ectz->maincomp;
+	e_cal_comp = ectz->maincomp;
 	/* log_debug("\nconvert_ECalComponent_to_ievent is called..."); */
 	if (e_cal_comp == NULL || e_cal_component_get_vtype(e_cal_comp) != E_CAL_COMPONENT_EVENT)
 		return;
@@ -84,7 +90,7 @@ process_event_e_to_i(const ECalComponentWithTZ *ectz, I_event *i_event, GError *
 	conv_incidence_e_to_i(ectz, i_event->incidence);
 
 	/* show_time_as */
-	ECalComponentTransparency *e_transp = g_new0(ECalComponentTransparency, 1);
+	e_transp = g_new0(ECalComponentTransparency, 1);
 	e_cal_component_get_transparency(e_cal_comp, e_transp);
 	if (e_transp)
 		i_event->show_time_as = transparency_to_show_time_as(*e_transp);
@@ -92,7 +98,7 @@ process_event_e_to_i(const ECalComponentWithTZ *ectz, I_event *i_event, GError *
 	g_free(e_transp);
 
 	/* end_date */
-	ECalComponentDateTime *e_end_date = g_new0(ECalComponentDateTime, 1);
+	e_end_date = g_new0(ECalComponentDateTime, 1);
 	e_cal_component_get_dtend (e_cal_comp, e_end_date);
 	if (e_end_date && e_end_date->value) {
 		localtime_to_utc(e_end_date, ectz->timezone);
diff --git a/src/libekolabconv/main/src/evolution/event-i-to-e.c b/src/libekolabconv/main/src/evolution/event-i-to-e.c
index 7afa007..20a8a72 100644
--- a/src/libekolabconv/main/src/evolution/event-i-to-e.c
+++ b/src/libekolabconv/main/src/evolution/event-i-to-e.c
@@ -55,14 +55,18 @@ show_time_as_to_transparency(Show_time_as sta)
 ECalComponentWithTZ*
 conv_I_event_to_ECalComponentWithTZ (I_event **i_event_ptr, GError **error)
 {
+	ECalComponent* e_cal_comp = NULL;
+	I_event *i_event = NULL;
+	ECalComponentWithTZ *ectz = NULL;
+	
 	g_assert(error != NULL && *error == NULL);
 	log_debug ("\nconv_I_event_to_ECalComponentWithTZ(): convert I_event to ECalcomponentWithTZ.");
 
-	ECalComponent* e_cal_comp = e_cal_component_new ();
-	ECalComponentWithTZ *ectz = g_new0(ECalComponentWithTZ, 1);
+	e_cal_comp = e_cal_component_new ();
+	ectz = g_new0(ECalComponentWithTZ, 1);
 	ectz->maincomp = e_cal_comp;
 
-	I_event *i_event = *i_event_ptr;
+	i_event = *i_event_ptr;
 
 	if (i_event) {
 		/* type */
diff --git a/src/libekolabconv/main/src/evolution/evolution-util.c b/src/libekolabconv/main/src/evolution/evolution-util.c
index 684b9c3..5977968 100644
--- a/src/libekolabconv/main/src/evolution/evolution-util.c
+++ b/src/libekolabconv/main/src/evolution/evolution-util.c
@@ -47,7 +47,9 @@ date_or_datetime_e_to_i(icaltimetype *t, Date_or_datetime *date)
 time_t *
 datetime_e_to_i(icaltimetype *t)
 {
-	struct tm * timeinfo = g_new0(struct tm, 1);
+	struct tm *timeinfo = g_new0(struct tm, 1);
+	time_t *dt = g_new0(time_t, 1);
+
 	timeinfo->tm_year = t->year-1900;
 	timeinfo->tm_mon = t->month-1;
 	timeinfo->tm_mday = t->day;
@@ -55,7 +57,6 @@ datetime_e_to_i(icaltimetype *t)
 	timeinfo->tm_min = t->minute;
 	timeinfo->tm_sec = t->second;
 
-	time_t *dt = g_new0(time_t, 1);
 	*dt = timegm( timeinfo );
 	g_free(timeinfo);
 	return dt;
@@ -155,14 +156,17 @@ utc_to_localtime(ECalComponentDateTime *date_time, gchar *vtimezone)
 void
 localtime_to_utc(ECalComponentDateTime *date_time, ECalComponent *local_tz)
 {
+	icaltimezone *ical_tz = NULL;
+	icaltimezone *utc = NULL;
+	
 	if (date_time->value->is_utc || local_tz == NULL) /* local_tz == UTC */
 		return;
 
 	/* get icaltimezone for localtime */
-	icaltimezone *ical_tz = ecalcomponent_tz_get_icaltimezone(local_tz);
+	ical_tz = ecalcomponent_tz_get_icaltimezone(local_tz);
 
 	/* get icaltimezone for UTC */
-	icaltimezone *utc = icaltimezone_get_utc_timezone();
+	utc = icaltimezone_get_utc_timezone();
 
 	/* ...convert time */
 	icaltimezone_convert_time(date_time->value, ical_tz, utc);
diff --git a/src/libekolabconv/main/src/evolution/note-e-to-i.c b/src/libekolabconv/main/src/evolution/note-e-to-i.c
index 06a8b39..df248b4 100644
--- a/src/libekolabconv/main/src/evolution/note-e-to-i.c
+++ b/src/libekolabconv/main/src/evolution/note-e-to-i.c
@@ -37,12 +37,15 @@
 I_note*
 conv_ECalComponentWithTZ_to_I_note (const ECalComponentWithTZ *e_note, GError **error)
 {
+	I_note *i_note = NULL;
+	
 	g_assert(error != NULL && *error == NULL);
 	log_debug ("\nconv_ECalComponentWithTZ_to_I_note(): convert ECalcomponentWithTZ to I_note struct.");
 
-	I_note *i_note = new_i_note();
+	i_note = new_i_note();
 
 	if (e_note) {
+		ECalComponentText *text = NULL;
 		ECalComponent *e_cal_comp = e_note->maincomp;
 
 		if (e_cal_comp == NULL || e_cal_component_get_vtype(e_cal_comp) != E_CAL_COMPONENT_JOURNAL)
@@ -52,7 +55,7 @@ conv_ECalComponentWithTZ_to_I_note (const ECalComponentWithTZ *e_note, GError **
 		e_kolab_store_get_fields(e_note, i_note->common);
 		i_evo_store_add_cal_note(i_note->common, e_note);
 
-		ECalComponentText *text = g_new0(ECalComponentText, 1);
+		text = g_new0(ECalComponentText, 1);
 		e_cal_component_get_summary(e_cal_comp, text);
 		if (text)
 			i_note->summary = g_string_new(text->value);
diff --git a/src/libekolabconv/main/src/evolution/note-i-to-e.c b/src/libekolabconv/main/src/evolution/note-i-to-e.c
index 7e9c68b..126b704 100644
--- a/src/libekolabconv/main/src/evolution/note-i-to-e.c
+++ b/src/libekolabconv/main/src/evolution/note-i-to-e.c
@@ -36,14 +36,18 @@
 ECalComponentWithTZ*
 conv_I_note_to_ECalComponentWithTZ (I_note **i_note_ptr, GError **error)
 {
+	ECalComponent *e_cal_comp = NULL;
+	ECalComponentWithTZ *ectz = NULL;
+	I_note *i_note = NULL;
+	
 	g_assert(error != NULL && *error == NULL);
 	log_debug ("\nconv_I_note_to_ECalComponentWithTZ(): convert I_note struct to ECalcomponentWithTZ.");
 
-	ECalComponent* e_cal_comp = e_cal_component_new ();
-	ECalComponentWithTZ *ectz = g_new0(ECalComponentWithTZ, 1);
+	e_cal_comp = e_cal_component_new ();
+	ectz = g_new0(ECalComponentWithTZ, 1);
 	ectz->maincomp = e_cal_comp;
 
-	I_note *i_note = *i_note_ptr;
+	i_note = *i_note_ptr;
 
 	if (i_note) {
 		e_cal_component_set_new_vtype (e_cal_comp, E_CAL_COMPONENT_JOURNAL);
@@ -53,9 +57,10 @@ conv_I_note_to_ECalComponentWithTZ (I_note **i_note_ptr, GError **error)
 		kolab_attachment_store_i_to_e(e_cal_comp, i_note->common);
 
 		if (i_note->summary) {
+			char *sum_str = NULL;
 			ECalComponentText *text = g_new0(ECalComponentText, 1);
 			text->altrep = NULL;
-			char *sum_str = g_strdup(i_note->summary->str);
+			sum_str = g_strdup(i_note->summary->str);
 			text->value = sum_str;
 			e_cal_component_set_summary (e_cal_comp, text);
 			e_cal_component_commit_sequence (e_cal_comp);
diff --git a/src/libekolabconv/main/src/evolution/priv-common-e-to-i.c b/src/libekolabconv/main/src/evolution/priv-common-e-to-i.c
index a743e63..76e1c7f 100644
--- a/src/libekolabconv/main/src/evolution/priv-common-e-to-i.c
+++ b/src/libekolabconv/main/src/evolution/priv-common-e-to-i.c
@@ -40,20 +40,25 @@
 static gchar*
 get_vtimezone (const ECalComponentWithTZ *ectz)
 {
+	icalcomponent *icc = NULL;
+	icalproperty *dtstamp = NULL;
+	icalproperty *uid = NULL;
+	gchar *ical_str = NULL;
+	
 	if (ectz == NULL || ectz->maincomp == NULL || ectz->timezone == NULL)
 		return NULL;
 
-	icalcomponent *icc = e_cal_component_get_icalcomponent (ectz->timezone);
+	icc = e_cal_component_get_icalcomponent (ectz->timezone);
 
 	/* uid and dtstamp are not needed (nor wanted) in timezone block */
-	icalproperty *uid = icalcomponent_get_first_property(icc, ICAL_UID_PROPERTY);
+	uid = icalcomponent_get_first_property(icc, ICAL_UID_PROPERTY);
 	icalcomponent_remove_property (icc, uid);
 	free(uid);
-	icalproperty *dtstamp = icalcomponent_get_first_property(icc, ICAL_DTSTAMP_PROPERTY);
+	dtstamp = icalcomponent_get_first_property(icc, ICAL_DTSTAMP_PROPERTY);
 	icalcomponent_remove_property (icc, dtstamp);
 	free(dtstamp);
 
-	gchar *ical_str = icalcomponent_as_ical_string (icc);
+	ical_str = icalcomponent_as_ical_string (icc);
 
 	return ical_str;
 }
@@ -120,11 +125,14 @@ add_e_attachment_parameters(icalproperty *prop, I_common *i_common, gboolean inl
 	int i, pc = icalproperty_count_parameters(prop);
 	icalparameter *para;
 	for (i = 0; i < pc; i++) {
+		icalparameter_kind kind;
+		icalparameter_value xvalue;
+		
 		para = i == 0 ? icalproperty_get_first_parameter(prop, ICAL_ANY_PARAMETER) :
 				icalproperty_get_next_parameter(prop, ICAL_ANY_PARAMETER);
 
-		icalparameter_kind kind = icalparameter_isa(para);
-		icalparameter_value xvalue = icalparameter_get_value(para);
+		kind = icalparameter_isa(para);
+		xvalue = icalparameter_get_value(para);
 		if (kind == ICAL_VALUE_PARAMETER && xvalue == ICAL_VALUE_BINARY)
 			binary = TRUE; /* not a link attachment */
 		else if (kind == ICAL_FMTTYPE_PARAMETER) /* found mime type */
@@ -139,6 +147,8 @@ add_e_attachment_parameters(icalproperty *prop, I_common *i_common, gboolean inl
 
 	if (binary) { /* if not a linked attachment add data to struct */
 		Kolab_conv_mail_part *mpart = g_new0(Kolab_conv_mail_part, 1);
+		gchar* pname = NULL;
+		
 		if (label != NULL) {
 			if (inln)
 				i_common->inline_attachment_names = g_list_append(
@@ -149,7 +159,7 @@ add_e_attachment_parameters(icalproperty *prop, I_common *i_common, gboolean inl
 		if (mime_type != NULL)
 			mpart->mime_type = strdup(mime_type);
 		/* add data and length */
-		gchar* pname = (gchar*) icalproperty_get_value_as_string(prop);
+		pname = (gchar*) icalproperty_get_value_as_string(prop);
 		if (pname) {
 			gsize outlen;
 			mpart->data = (gchar*) g_base64_decode (pname, &outlen);
@@ -167,12 +177,19 @@ add_e_attachment_parameters(icalproperty *prop, I_common *i_common, gboolean inl
 void
 conv_common_e_to_i (const ECalComponentWithTZ *ectz, I_common *i_common)
 {
+	GSList *descr_list = NULL;
+	const gchar *uid = NULL;
+	const gchar *categories = NULL;
+	struct icaltimetype *lastModifiedDate;
+	struct icaltimetype *createdDate;
+	icalcomponent *icomp = NULL;
+	icalproperty *prop = NULL;
+	
 	i_common->vtimezone = get_vtimezone(ectz);
 	sensitivity_e_to_i(ectz->maincomp, i_common);
 	link_attachments_e_to_i(ectz->maincomp, i_common);
 
 	/* handle description/body */
-	GSList *descr_list = NULL;
 	e_cal_component_get_description_list ((ECalComponent*) ectz->maincomp, &descr_list);
 
 	if (descr_list != NULL) {
@@ -182,21 +199,18 @@ conv_common_e_to_i (const ECalComponentWithTZ *ectz, I_common *i_common)
 	}
 
 	/* ******************************************SET UID************************************ */
-	const gchar *uid;
 	e_cal_component_get_uid (ectz->maincomp, &uid);
 
 	if (uid)
 		i_common->uid = g_string_new (uid);
 
 	/* ******************************************SET CATEGORIES************************************ */
-	const gchar *categories;
 	e_cal_component_get_categories (ectz->maincomp, &categories);
 
 	if (categories)
 		i_common->categories = g_string_new (categories);
 
 	/* ******************************************SET DATES (CREATION, LASTMODIFICATION, START, END etc.)************************************ */
-	struct icaltimetype *lastModifiedDate;
 
 	e_cal_component_get_last_modified (ectz->maincomp, &lastModifiedDate);
 	i_common->last_modified_datetime = new_date_or_datetime();
@@ -211,7 +225,6 @@ conv_common_e_to_i (const ECalComponentWithTZ *ectz, I_common *i_common)
 	}
 	g_free(lastModifiedDate);
 
-	struct icaltimetype *createdDate;
 	i_common->creation_datetime = new_date_or_datetime();
 	e_cal_component_get_created (ectz->maincomp, &createdDate);
 
@@ -228,8 +241,8 @@ conv_common_e_to_i (const ECalComponentWithTZ *ectz, I_common *i_common)
 	/* ******************************************SET ATTACHMENT LIST******************************************************************************* */
 
 	/* iterate over all ical properties */
-	icalcomponent *icomp = e_cal_component_get_icalcomponent (ectz->maincomp);
-	icalproperty *prop = icalcomponent_get_first_property(icomp, ICAL_ANY_PROPERTY);
+	icomp = e_cal_component_get_icalcomponent (ectz->maincomp);
+	prop = icalcomponent_get_first_property(icomp, ICAL_ANY_PROPERTY);
 	while (prop != NULL) {
 		icalproperty_kind kind = icalproperty_isa(prop);
 		gchar *pname = (gchar*) icalproperty_get_x_name(prop);
@@ -242,6 +255,3 @@ conv_common_e_to_i (const ECalComponentWithTZ *ectz, I_common *i_common)
 
 	i_common->is_html_richtext = FALSE;
 }
-
-
-
diff --git a/src/libekolabconv/main/src/evolution/priv-common-i-to-e.c b/src/libekolabconv/main/src/evolution/priv-common-i-to-e.c
index 8ecc540..78cb651 100644
--- a/src/libekolabconv/main/src/evolution/priv-common-i-to-e.c
+++ b/src/libekolabconv/main/src/evolution/priv-common-i-to-e.c
@@ -52,8 +52,9 @@ conv_common_i_to_e (ECalComponentWithTZ *ectz, I_common *common)
 
 		/* parse HTML if given */
 		if (common->is_html_richtext == TRUE) {
+			xmlChar *body_text = NULL;
 			description = g_strdup("");
-			xmlChar *body_text = (xmlChar*)common->body->str;
+			body_text = (xmlChar*)common->body->str;
 
 			if (body_text != NULL) {
 				xmlParserCtxtPtr p = xmlCreateDocParserCtxt(body_text);
@@ -77,9 +78,9 @@ conv_common_i_to_e (ECalComponentWithTZ *ectz, I_common *common)
 
 		if (description) {
 			ECalComponentText text;
+			GSList l;
 			text.value = description;
 			text.altrep = NULL;
-			GSList l;
 			l.data = &text;
 			l.next = NULL;
 			e_cal_component_set_description_list (ectz->maincomp, &l);
@@ -135,7 +136,9 @@ kolab_attachment_store_i_to_e (ECalComponent* e_cal_comp, I_common *icommon)
 
 	while (list != NULL) {
 		Kolab_conv_mail_part *mpart = ((Kolab_conv_mail_part *) list->data);
-
+		icalproperty *prop;
+		icalparameter *param;
+		
 		/* check if the name of the attachment is stored in the inline */
 		/* attachment names list */
 		GList *names = icommon->inline_attachment_names;
@@ -148,21 +151,24 @@ kolab_attachment_store_i_to_e (ECalComponent* e_cal_comp, I_common *icommon)
 			}
 		}
 
-		icalproperty *prop;
 		if (hidden) {
+			gchar *b64enc = NULL;
+			icalvalue *ival = NULL;
+			
 			prop = icalproperty_new_x("");
 			icalproperty_set_x_name(prop, ICONTACT_KOLAB_STORE_ATTACHMENT);
-			gchar *b64enc = g_base64_encode ((guchar*) mpart->data, mpart->length);
+			b64enc = g_base64_encode ((guchar*) mpart->data, mpart->length);
 
-			icalvalue *ival = icalvalue_new_x(b64enc);
+			ival = icalvalue_new_x(b64enc);
 			g_free(b64enc);
 			icalproperty_set_value(prop, ival);
 		} else {
+			icalattach *a;
 			/* ATTACH;VALUE=BINARY;FMTTYPE=image/gif;ENCODING=BASE64;X-LABEL=blablubb: */
 
 			/* create attach property with base64 content */
 			gchar *b64enc = g_base64_encode ((guchar*) mpart->data, mpart->length);
-			icalattach *a = icalattach_new_from_data(b64enc, icalattach_free_g_string, NULL);
+			a = icalattach_new_from_data(b64enc, icalattach_free_g_string, NULL);
 
 			g_free(b64enc);
 			prop = icalproperty_new_attach(a);
@@ -170,7 +176,7 @@ kolab_attachment_store_i_to_e (ECalComponent* e_cal_comp, I_common *icommon)
 		}
 
 		/* add value type */
-		icalparameter *param = icalparameter_new_value(ICAL_VALUE_BINARY);
+		param = icalparameter_new_value(ICAL_VALUE_BINARY);
 		icalproperty_add_parameter(prop, param);
 		/* add mime type */
 		if (mpart->mime_type) {
diff --git a/src/libekolabconv/main/src/evolution/priv-evolution-preserve.c b/src/libekolabconv/main/src/evolution/priv-evolution-preserve.c
index b3fd214..20bd784 100644
--- a/src/libekolabconv/main/src/evolution/priv-evolution-preserve.c
+++ b/src/libekolabconv/main/src/evolution/priv-evolution-preserve.c
@@ -91,13 +91,14 @@ i_evo_store_add_contact_by_name(EContact *e_contact, I_common *i_common, gchar *
 		if (strcmp(e_vcard_attribute_get_name (attrib), name) == 0) {
 			EVCardAttribute *attrib = (EVCardAttribute*)list->data;
 			EVCard *vcard;
+			gchar *vstr = NULL;
 			if (i_common->evolution_store) {
 				vcard = e_vcard_new_from_string (i_common->evolution_store);
 				g_free(i_common->evolution_store);
 			} else
 				vcard = e_vcard_new();
 			e_vcard_add_attribute(vcard, attrib);
-			gchar *vstr = e_vcard_to_string(vcard, EVC_FORMAT_VCARD_30);
+			vstr = e_vcard_to_string(vcard, EVC_FORMAT_VCARD_30);
 			i_common->evolution_store = vstr;
 		}
 	}
@@ -126,9 +127,11 @@ i_evo_store_add_cal(I_common *i_common, const ECalComponentWithTZ *ectz)
 void
 i_evo_store_add_cal_note(I_common *i_common, const ECalComponentWithTZ *ectz)
 {
+	icalcomponent *icomp;
+	
 	i_evo_store_add_cal(i_common, ectz);
 
-	icalcomponent *icomp = e_cal_component_get_icalcomponent (ectz->maincomp);
+	icomp = e_cal_component_get_icalcomponent (ectz->maincomp);
 	i_evo_store_add(i_common, icomp, ICAL_DTSTART_PROPERTY);
 }
 
@@ -217,12 +220,16 @@ e_kolab_store_get_fields(const ECalComponentWithTZ *ectz, I_common *i_common) {
 	while (prop != NULL) {
 		gchar *pname = (gchar*) icalproperty_get_x_name(prop);
 		if (pname && strcmp(pname, ICONTACT_KOLAB_STORE) == 0) {
-			pname = (gchar*) icalproperty_get_x(prop);
 			gsize outlen;
-			guchar *b64enc = g_base64_decode (pname, &outlen);
+			guchar *b64enc = NULL;
+			gpointer parent_ptr = NULL;
+			const gchar *id_str = NULL;
+			
+			pname = (gchar*) icalproperty_get_x(prop);
+			b64enc = g_base64_decode (pname, &outlen);
 
-			gpointer parent_ptr = i_common;
-			const gchar *id_str = icalproperty_get_parameter_as_string(prop, ICONTACT_KOLAB_STORE_ID);
+			parent_ptr = i_common;
+			id_str = icalproperty_get_parameter_as_string(prop, ICONTACT_KOLAB_STORE_ID);
 			if (id_str != NULL)
 				parent_ptr = (gpointer) strtol (id_str, NULL, 10);
 
@@ -244,8 +251,11 @@ e_kolab_store_add_field_group(ECalComponentWithTZ *ectz, I_common *i_common, gpo
 		GList *list = kolab_store_get_element_list(i_common, parent_ptr);
 		for (list = g_list_last (list); list != NULL; list = list->prev) {
 			icalproperty *prop = icalproperty_new_x("");
-			icalproperty_set_x_name(prop, ICONTACT_KOLAB_STORE);
 			icalparameter *para = icalparameter_new_encoding(ICAL_ENCODING_BASE64);
+			gchar *b64enc = NULL;
+			icalvalue *ival = NULL;
+			
+			icalproperty_set_x_name(prop, ICONTACT_KOLAB_STORE);
 			icalproperty_add_parameter(prop, para);
 			if (parent_ptr != i_common) { /* sub element field? => store id */
 				gchar id_str[5];
@@ -254,8 +264,8 @@ e_kolab_store_add_field_group(ECalComponentWithTZ *ectz, I_common *i_common, gpo
 				icalparameter_set_xname(para, ICONTACT_KOLAB_STORE_ID);
 				icalproperty_add_parameter(prop, para);
 			}
-			gchar *b64enc = g_base64_encode ((guchar*) list->data, strlen((gchar*)list->data));
-			icalvalue *ival = icalvalue_new_x(b64enc);
+			b64enc = g_base64_encode ((guchar*) list->data, strlen((gchar*)list->data));
+			ival = icalvalue_new_x(b64enc);
 			g_free(b64enc);
 			icalproperty_set_value(prop, ival);
 			icalcomponent_add_property(icomp, prop);
diff --git a/src/libekolabconv/main/src/evolution/priv-incidence-e-to-i.c b/src/libekolabconv/main/src/evolution/priv-incidence-e-to-i.c
index 807ef02..0d8d044 100644
--- a/src/libekolabconv/main/src/evolution/priv-incidence-e-to-i.c
+++ b/src/libekolabconv/main/src/evolution/priv-incidence-e-to-i.c
@@ -53,16 +53,22 @@ static void recurrence_set_range (struct icalrecurrencetype *rec_type, Recurrenc
 void
 conv_incidence_e_to_i (const ECalComponentWithTZ *ectz, I_incidence *i_incidence)
 {
+	const gchar *location = NULL;
+	ECalComponentText *summary = NULL;
+	ECalComponentOrganizer *e_cal_comp_org = NULL;
+	ECalComponentDateTime *start_date = NULL;
+	GSList *attendee_list = NULL;
+	ECalComponentAttendee *ca = NULL;
+
 	conv_common_e_to_i (ectz, i_incidence->common);
 
 	/* ******************************************SET LOCATION************************************ */
-	const gchar *location;
 	e_cal_component_get_location(ectz->maincomp, &location);
 	if (location)
 		i_incidence->location = g_string_new(location);
 
 	/* ******************************************SET SUMMARY************************************ */
-	ECalComponentText *summary = g_new0(ECalComponentText, 1);
+	summary = g_new0(ECalComponentText, 1);
 	e_cal_component_get_summary (ectz->maincomp, summary);
 	if (summary && summary->value && *summary->value)
 		i_incidence->summary = g_string_new(summary->value);
@@ -72,7 +78,7 @@ conv_incidence_e_to_i (const ECalComponentWithTZ *ectz, I_incidence *i_incidence
 	g_free(summary);
 
 	/* ******************************************SET ORGANIZER************************************ */
-	ECalComponentOrganizer *e_cal_comp_org = g_new0(ECalComponentOrganizer, 1);
+	e_cal_comp_org = g_new0(ECalComponentOrganizer, 1);
 	e_cal_component_get_organizer(ectz->maincomp, e_cal_comp_org);
 	if (e_cal_comp_org->cn)
 		i_incidence->organizer_display_name = g_string_new(e_cal_comp_org->cn);
@@ -81,7 +87,7 @@ conv_incidence_e_to_i (const ECalComponentWithTZ *ectz, I_incidence *i_incidence
 	g_free(e_cal_comp_org);
 
 
-	ECalComponentDateTime *start_date = g_new0(ECalComponentDateTime, 1);
+	start_date = g_new0(ECalComponentDateTime, 1);
 	e_cal_component_get_dtstart (ectz->maincomp, start_date);
 	if (start_date && start_date->value) {
 		localtime_to_utc(start_date, ectz->timezone);
@@ -101,6 +107,9 @@ conv_incidence_e_to_i (const ECalComponentWithTZ *ectz, I_incidence *i_incidence
 			gchar *alarm_uid = ((gchar *)alarm_list->data);
 			ECalComponentAlarm *ecalcomp_alarm = e_cal_component_get_alarm(ectz->maincomp, alarm_uid);
 			if (ecalcomp_alarm) {
+				ECalComponentAlarmTrigger *trigger = NULL;
+				ECalComponentAlarmRepeat *repeat = NULL;
+
 				/* new Alarm object to append later at i_incidence list */
 				Alarm *alarm = g_new0(Alarm, 1);
 
@@ -122,35 +131,41 @@ conv_incidence_e_to_i (const ECalComponentWithTZ *ectz, I_incidence *i_incidence
 					alarm->audio_file = g_string_new(icalattach_get_url(attach));
 				}
 				if (alarm->type == I_ALARM_TYPE_PROCEDURE) {
-					alarm = new_alarm(I_ALARM_TYPE_PROCEDURE);
+					icalattach *attach;
+					ECalComponentText *text = NULL;
 
+					alarm = new_alarm(I_ALARM_TYPE_PROCEDURE);
+					
 					/* set program */
-					icalattach *attach;
 					e_cal_component_alarm_get_attach (ecalcomp_alarm, &attach);
 					alarm->proc_param->program = g_string_new(icalattach_get_url(attach));
 
 					/* set arguments */
-					ECalComponentText *text = g_new0(ECalComponentText, 1);
+					text = g_new0(ECalComponentText, 1);
 					e_cal_component_alarm_get_description(ecalcomp_alarm, text);
 					alarm->proc_param->arguments = g_string_new(text->value);
 					g_free(text);
 				}
 				if (alarm->type == I_ALARM_TYPE_EMAIL) {
+					ECalComponentText *text = NULL;
+					GSList *attendee_list = NULL;
+					
 					alarm = new_alarm(I_ALARM_TYPE_EMAIL);
 
 					/* set mail text */
-					ECalComponentText *text = g_new0(ECalComponentText, 1);
+					text = g_new0(ECalComponentText, 1);
 					e_cal_component_alarm_get_description(ecalcomp_alarm, text);
 					alarm->email_param->mail_text = g_string_new(text->value);
 					g_free(text);
 
 					/* set mail addresses */
-					GSList *attendee_list = NULL;
 					e_cal_component_alarm_get_attendee_list(ecalcomp_alarm, &attendee_list);
 					for (; attendee_list; attendee_list = attendee_list->next) {
+						gchar* value = NULL;
+						
 						ECalComponentAttendee *ca = (ECalComponentAttendee *) attendee_list->data;
 
-						gchar* value = ca->value;
+						value = ca->value;
 						if (g_str_has_prefix(value, "MAILTO:"))/* increase pointer by 7 to cut off prefix */
 							value +=7;
 
@@ -163,7 +178,7 @@ conv_incidence_e_to_i (const ECalComponentWithTZ *ectz, I_incidence *i_incidence
 				}
 
 				/* trigger */
-				ECalComponentAlarmTrigger *trigger = g_new0(ECalComponentAlarmTrigger, 1);
+				trigger = g_new0(ECalComponentAlarmTrigger, 1);
 				e_cal_component_alarm_get_trigger (ecalcomp_alarm, trigger);
 				if (trigger->type == E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START)
 					alarm->start_offset = (icaldurationtype_as_int(trigger->u.rel_duration)/60); /* (/60) as_int returns seconds, but kolab saved minutes */
@@ -208,7 +223,7 @@ conv_incidence_e_to_i (const ECalComponentWithTZ *ectz, I_incidence *i_incidence
 				g_free(trigger);
 
 				/* repeat (count & interval) */
-				ECalComponentAlarmRepeat *repeat = g_new0(ECalComponentAlarmRepeat, 1);
+				repeat = g_new0(ECalComponentAlarmRepeat, 1);
 				e_cal_component_alarm_get_repeat (ecalcomp_alarm, repeat);
 				if (repeat->repetitions)
 					alarm->repeat_count = repeat->repetitions;
@@ -228,15 +243,14 @@ conv_incidence_e_to_i (const ECalComponentWithTZ *ectz, I_incidence *i_incidence
 	}
 
 	/* ******************************************SET ATTENDEE LIST******************************************************************************* */
-	GSList *attendee_list = NULL;
-	ECalComponentAttendee *ca;
 
 	e_cal_component_get_attendee_list(ectz->maincomp, &attendee_list);
 
 	while (attendee_list) {
+		Attendee *attendee = g_new0(Attendee, 1);
+
 		ca = (ECalComponentAttendee *) attendee_list->data;
 
-		Attendee *attendee = g_new0(Attendee, 1);
 		if (ca->cn)
 			attendee->display_name = g_string_new(ca->cn);
 
@@ -414,9 +428,11 @@ recurrence_type_e_to_i (struct icalrecurrencetype *rec_type)
 static void
 recurrence_e_to_i (const ECalComponentWithTZ *ectz, I_incidence *i_incidence)
 {
+	GSList *exdate_list = NULL;
+	GSList *rec_list = NULL;
+
 	/* ******************************************SET RECURRENCE******************************************************************************* */
 	/* ******************************************SET RECURRENCE EXCLUSIONS******************************************************************** */
-	GSList *exdate_list;
 	e_cal_component_get_exdate_list (ectz->maincomp, &exdate_list);
 	if (exdate_list)
 		i_incidence->recurrence = new_recurrence();
@@ -434,13 +450,13 @@ recurrence_e_to_i (const ECalComponentWithTZ *ectz, I_incidence *i_incidence)
 	}
 	g_slist_free(exdate_list);
 	/* ******************************************SET RECURRENCE CYCLE******************************************************************** */
-	GSList *rec_list = NULL;
 	e_cal_component_get_rrule_list (ectz->maincomp, &rec_list);
 
 	while (rec_list != NULL) {
+		struct icalrecurrencetype *rec_type = (struct icalrecurrencetype *) rec_list->data;
+
 		if (i_incidence->recurrence == NULL)
 			i_incidence->recurrence = new_recurrence();
-		struct icalrecurrencetype *rec_type = (struct icalrecurrencetype *) rec_list->data;
 
 		i_incidence->recurrence->recurrence_cycle = recurrence_type_e_to_i (rec_type);
 		recurrence_set_range (rec_type, i_incidence->recurrence);
@@ -454,10 +470,11 @@ recurrence_e_to_i (const ECalComponentWithTZ *ectz, I_incidence *i_incidence)
 				&& rec_type->by_set_pos[0] != ICAL_RECURRENCE_ARRAY_MAX
 				&& rec_type->by_set_pos[1] == ICAL_RECURRENCE_ARRAY_MAX
 				&& i_incidence->recurrence->interval == 12) {
+			gint month = 0;
+
 			i_incidence->recurrence->recurrence_cycle = I_REC_CYCLE_YEARLY_WEEKDAY;
 			i_incidence->recurrence->interval = 1;
 
-			gint month = 0;
 			if (i_incidence->start_date && i_incidence->start_date->date)
 				month = g_date_get_month(i_incidence->start_date->date);
 			else if (i_incidence->start_date && i_incidence->start_date->date_time != NULL) {
diff --git a/src/libekolabconv/main/src/evolution/priv-incidence-i-to-e.c b/src/libekolabconv/main/src/evolution/priv-incidence-i-to-e.c
index 71c9bd8..f39e414 100644
--- a/src/libekolabconv/main/src/evolution/priv-incidence-i-to-e.c
+++ b/src/libekolabconv/main/src/evolution/priv-incidence-i-to-e.c
@@ -60,8 +60,8 @@ conv_incidence_i_to_e(ECalComponentWithTZ *ectz, I_incidence *i_incidence)
 
 	if (i_incidence->summary) {
 		ECalComponentText *text = g_new0(ECalComponentText, 1);
-		text->altrep = NULL;
 		gchar *val_str = g_strdup(i_incidence->summary->str);
+		text->altrep = NULL;
 		text->value = val_str;
 		e_cal_component_set_summary(ectz->maincomp, text);
 		g_free(val_str);
@@ -176,6 +176,8 @@ alarm_i_to_e(ECalComponentWithTZ *ectz, I_incidence *i_incidence)
 		while (alarm_list) {
 			ECalComponentAlarm *e_alarm = e_cal_component_alarm_new();
 			Alarm *i_alarm = (Alarm *) alarm_list->data;
+			ECalComponentAlarmTrigger *trigger = NULL;
+			ECalComponentAlarmRepeat *repeat = NULL;
 
 			/* type / action */
 			e_cal_component_alarm_set_action(e_alarm, alarm_type_i_to_e(i_alarm->type));
@@ -217,6 +219,10 @@ alarm_i_to_e(ECalComponentWithTZ *ectz, I_incidence *i_incidence)
 				icalattach_unref(attach);
 			}
 			if (i_alarm->type == I_ALARM_TYPE_EMAIL) {
+				GSList *attendee_list = NULL;
+				ECalComponentAttendee *ca;
+				GList *temp = NULL;
+
 				/* set email text */
 				if (i_alarm->email_param->mail_text) {
 					ECalComponentText *text = g_new0(ECalComponentText, 1);
@@ -226,9 +232,7 @@ alarm_i_to_e(ECalComponentWithTZ *ectz, I_incidence *i_incidence)
 				}
 
 				/* set mail recipients */
-				GSList *attendee_list = NULL;
-				ECalComponentAttendee *ca;
-				GList *temp = i_alarm->email_param->addresses;
+				temp = i_alarm->email_param->addresses;
 				for (; temp; temp = temp->next) {
 					GString *attendee = (GString *) temp->data;
 					ca = g_new0 (ECalComponentAttendee, 1);
@@ -244,17 +248,17 @@ alarm_i_to_e(ECalComponentWithTZ *ectz, I_incidence *i_incidence)
 			}
 
 			/* trigger */
-			ECalComponentAlarmTrigger *trigger = g_new0(ECalComponentAlarmTrigger, 1);
+			trigger = g_new0(ECalComponentAlarmTrigger, 1);
 			if (i_alarm->start_offset) {
-				trigger->type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START;
 				struct icaldurationtype *duration = create_duration(i_alarm->start_offset);
+				trigger->type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START;
 				trigger->u.rel_duration = *duration;
 				g_free(duration);
 				e_cal_component_alarm_set_trigger(e_alarm, *trigger);
 			}
 			else if (i_alarm->end_offset) {
-				trigger->type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_END;
 				struct icaldurationtype *duration = create_duration(i_alarm->end_offset);
+				trigger->type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_END;
 				trigger->u.rel_duration = *duration;
 				g_free(duration);
 				e_cal_component_alarm_set_trigger(e_alarm, *trigger);
@@ -262,7 +266,7 @@ alarm_i_to_e(ECalComponentWithTZ *ectz, I_incidence *i_incidence)
 			g_free(trigger);
 
 			/* repeat (count & interval) */
-			ECalComponentAlarmRepeat *repeat = g_new0(ECalComponentAlarmRepeat, 1);
+			repeat = g_new0(ECalComponentAlarmRepeat, 1);
 			if (i_alarm->repeat_count)
 				repeat->repetitions = i_alarm->repeat_count;
 			if (i_alarm->repeat_interval) {
@@ -387,13 +391,17 @@ frequency_i_to_e(Recurrence *recurrence)
 static void
 recurrence_fields_i_to_e(ECalComponentWithTZ *ectz, I_incidence *i_incidence)
 {
+	GSList *exdate_list = NULL;
+	GList *excl_list = NULL;
+	GSList *recur_list = NULL;
+	struct icalrecurrencetype *rec_type = NULL;
+	
 	if(i_incidence->recurrence == NULL)
 		return;
 
 	/* ******************************************SET RECURRENCE EXCLUSIONS******************************************************************************* */
 
-	GSList *exdate_list = NULL;
-	GList *excl_list = i_incidence->recurrence->exclusion;
+	excl_list = i_incidence->recurrence->exclusion;
 
 	while (excl_list) {
 		ECalComponentDateTime *ecal_comp_datetime;
@@ -418,8 +426,7 @@ recurrence_fields_i_to_e(ECalComponentWithTZ *ectz, I_incidence *i_incidence)
 
 	/* ******************************************SET RECURRENCE RULES******************************************************************************* */
 
-	GSList *recur_list = NULL;
-	struct icalrecurrencetype *rec_type = g_new0(struct icalrecurrencetype, 1);
+	rec_type = g_new0(struct icalrecurrencetype, 1);
 	icalrecurrencetype_clear(rec_type);
 
 	/* I_REC_CYCLE_YEARLY_WEEKDAY gets special treatment: yearly recurrence on the n-th day
@@ -630,6 +637,3 @@ recurrence_set_by_day(struct icalrecurrencetype *rec_type, gint weekdays)
 		rec_type->by_day[i] = weekday_i_to_e(&weekdays) ;
 	rec_type->by_day[i] = ICAL_RECURRENCE_ARRAY_MAX;
 }
-
-
-
diff --git a/src/libekolabconv/main/src/evolution/task-e-to-i.c b/src/libekolabconv/main/src/evolution/task-e-to-i.c
index 2325b7a..62beb27 100644
--- a/src/libekolabconv/main/src/evolution/task-e-to-i.c
+++ b/src/libekolabconv/main/src/evolution/task-e-to-i.c
@@ -55,13 +55,21 @@ task_status_e_to_i (icalproperty_status i_cal_prop_stat)
 I_task*
 conv_ECalComponentWithTZ_to_I_task (const ECalComponentWithTZ *ectz, GError **error)
 {
+	I_task *i_task = NULL;
+	
 	g_assert(error != NULL && *error == NULL);
 	log_debug ("\nconv_ECalComponentWithTZ_to_I_task(): convert ECalComponentWithTZ to I_task.");
 
-	I_task *i_task = new_i_task();
+	i_task = new_i_task();
 
 	if (ectz) {
 		ECalComponent *e_cal_comp = ectz->maincomp;
+		ECalComponentDateTime *due_date = NULL;
+		ECalComponentDateTime *completed_date = NULL;
+		gint *priority = NULL;
+		gint *percent = NULL;
+		icalproperty_status *prop = NULL;
+		
 		/* log_debug("\nconvert_ECalComponent_to_itask is called..."); */
 		if (e_cal_comp == NULL || e_cal_component_get_vtype (e_cal_comp) != E_CAL_COMPONENT_TODO)
 			return i_task;
@@ -70,14 +78,12 @@ conv_ECalComponentWithTZ_to_I_task (const ECalComponentWithTZ *ectz, GError **er
 		conv_incidence_e_to_i (ectz, i_task->incidence);
 
 		/* Priority */
-		gint * priority;
 		e_cal_component_get_priority (e_cal_comp, &priority);
 		if (priority)
 			i_task->priority = *priority;
 		e_cal_component_free_priority(priority);
 
 		/* I_TASK_COMPLETED */
-		gint *percent;
 		e_cal_component_get_percent (e_cal_comp, &percent);
 		if (percent == 0)
 			i_task->completed = 0;
@@ -85,13 +91,13 @@ conv_ECalComponentWithTZ_to_I_task (const ECalComponentWithTZ *ectz, GError **er
 			i_task->completed = (guint) *percent;
 
 		/* Incidence_status */
-		icalproperty_status * prop = g_new0(icalproperty_status, 1);
+		prop = g_new0(icalproperty_status, 1);
 		e_cal_component_get_status (e_cal_comp, prop);
 		i_task->status = task_status_e_to_i(*prop);
 		g_free(prop);
 
 		/* due_date */
-		ECalComponentDateTime *due_date = g_new0(ECalComponentDateTime, 1);
+		due_date = g_new0(ECalComponentDateTime, 1);
 		e_cal_component_get_due (e_cal_comp, due_date);
 		if (due_date && due_date->value) {
 			localtime_to_utc (due_date, ectz->timezone);
@@ -102,7 +108,7 @@ conv_ECalComponentWithTZ_to_I_task (const ECalComponentWithTZ *ectz, GError **er
 		g_free (due_date);
 
 		/* completed date */
-		ECalComponentDateTime *completed_date = g_new0(ECalComponentDateTime, 1);
+		completed_date = g_new0(ECalComponentDateTime, 1);
 		e_cal_component_get_completed(e_cal_comp, &completed_date->value);
 		if (completed_date && completed_date->value)
 			i_task->completed_datetime = datetime_e_to_i (completed_date->value);
diff --git a/src/libekolabconv/main/src/evolution/task-i-to-e.c b/src/libekolabconv/main/src/evolution/task-i-to-e.c
index c7796ca..9be2fef 100644
--- a/src/libekolabconv/main/src/evolution/task-i-to-e.c
+++ b/src/libekolabconv/main/src/evolution/task-i-to-e.c
@@ -59,14 +59,18 @@ task_status_i_to_e (Task_status ical_status)
 ECalComponentWithTZ*
 conv_I_task_to_ECalComponentWithTZ (I_task **i_task_ptr, GError **error)
 {
+	ECalComponent *e_cal_comp = NULL;
+	ECalComponentWithTZ *ectz = NULL;
+	I_task *i_task = NULL;
+	
 	g_assert(error != NULL && *error == NULL);
 	log_debug ("\nconv_ECalComponentWithTZ_to_I_task(): convert ECalComponentWithTZ to I_task.");
 
-	ECalComponent* e_cal_comp = e_cal_component_new ();
-	ECalComponentWithTZ *ectz = g_new0(ECalComponentWithTZ, 1);
+	e_cal_comp = e_cal_component_new ();
+	ectz = g_new0(ECalComponentWithTZ, 1);
 	ectz->maincomp = e_cal_comp;
 
-	I_task *i_task = *i_task_ptr;
+	i_task = *i_task_ptr;
 
 	if (i_task) {
 		e_cal_component_set_new_vtype (e_cal_comp, E_CAL_COMPONENT_TODO);
diff --git a/src/libekolabconv/main/src/kolab-conv.c b/src/libekolabconv/main/src/kolab-conv.c
index 3546cd4..9f52f21 100644
--- a/src/libekolabconv/main/src/kolab-conv.c
+++ b/src/libekolabconv/main/src/kolab-conv.c
@@ -264,10 +264,12 @@ kolabconv_shutdown (void)
 EContact*
 kolabconv_kcontact_to_econtact (const Kolab_conv_mail* kmail, GError** error)
 {
-	log_kolab_mail("input data:", kmail);
 	EContact *econtact = NULL;
+	I_contact *icontact = NULL;
+	
+	log_kolab_mail("input data:", kmail);
 	/* create icontact */
-	I_contact *icontact = conv_kolab_conv_mail_to_I_contact(kmail, error);
+	icontact = conv_kolab_conv_mail_to_I_contact(kmail, error);
 	/* create evolution contact if success */
 	if (*error == NULL)
 		econtact = conv_I_contact_to_EContact(&icontact, error);
@@ -291,10 +293,12 @@ kolabconv_kcontact_to_econtact (const Kolab_conv_mail* kmail, GError** error)
 Kolab_conv_mail*
 kolabconv_econtact_to_kcontact (const EContact* econtact, GError** error)
 {
-	log_evolution_vcard("input data:", econtact);
 	Kolab_conv_mail *kmail = NULL;
+	I_contact *icontact = NULL;
+	
+	log_evolution_vcard("input data:", econtact);
 	/* create icontact */
-	I_contact *icontact = conv_EContact_to_I_contact(econtact, error);
+	icontact = conv_EContact_to_I_contact(econtact, error);
 	/* create kolab contact mail if success */
 	if (*error == NULL)
 		kmail = conv_I_contact_to_kolab_conv_mail(&icontact, error);
@@ -317,10 +321,12 @@ kolabconv_econtact_to_kcontact (const EContact* econtact, GError** error)
 ECalComponentWithTZ*
 kolabconv_kevent_to_eevent (const Kolab_conv_mail* kmail, GError** error)
 {
-	log_kolab_mail("input data:", kmail);
 	ECalComponentWithTZ *eevent = NULL;
+	I_event *ievent = NULL;
+	
+	log_kolab_mail("input data:", kmail);
 	/* create internal pim struct */
-	I_event *ievent = conv_kolab_conv_mail_to_I_event(kmail, error);
+	ievent = conv_kolab_conv_mail_to_I_event(kmail, error);
 	/* create evolution pim object if success */
 	if (*error == NULL)
 		eevent = conv_I_event_to_ECalComponentWithTZ(&ievent, error);
@@ -344,10 +350,12 @@ kolabconv_kevent_to_eevent (const Kolab_conv_mail* kmail, GError** error)
 Kolab_conv_mail*
 kolabconv_eevent_to_kevent (const ECalComponentWithTZ* ecalcomp, GError** error)
 {
-	log_evolution_ical("input data:", ecalcomp);
 	Kolab_conv_mail *kmail = NULL;
+	I_event *ievent = NULL;
+	
+	log_evolution_ical("input data:", ecalcomp);
 	/* create internal pim struct */
-	I_event *ievent = conv_ECalComponentWithTZ_to_I_event(ecalcomp, error);
+	ievent = conv_ECalComponentWithTZ_to_I_event(ecalcomp, error);
 	/* create kolab mail if success */
 	if (*error == NULL)
 		kmail = conv_I_event_to_kolab_conv_mail(&ievent, error);
@@ -370,10 +378,12 @@ kolabconv_eevent_to_kevent (const ECalComponentWithTZ* ecalcomp, GError** error)
 ECalComponentWithTZ*
 kolabconv_ktask_to_etask (const Kolab_conv_mail* kmail, GError** error)
 {
-	log_kolab_mail("input data:", kmail);
 	ECalComponentWithTZ *etask = NULL;
+	I_task *itask = NULL;
+	
+	log_kolab_mail("input data:", kmail);
 	/* create internal pim struct */
-	I_task *itask = conv_kolab_conv_mail_to_I_task(kmail, error);
+	itask = conv_kolab_conv_mail_to_I_task(kmail, error);
 	/* create evolution pim object if success */
 	if (*error == NULL)
 		etask = conv_I_task_to_ECalComponentWithTZ(&itask, error);
@@ -397,10 +407,12 @@ kolabconv_ktask_to_etask (const Kolab_conv_mail* kmail, GError** error)
 Kolab_conv_mail*
 kolabconv_etask_to_ktask (const ECalComponentWithTZ* ecalcomp, GError** error)
 {
-	log_evolution_ical("input data:", ecalcomp);
 	Kolab_conv_mail *kmail = NULL;
+	I_task *itask = NULL;
+	
+	log_evolution_ical("input data:", ecalcomp);
 	/* create internal pim struct */
-	I_task *itask = conv_ECalComponentWithTZ_to_I_task(ecalcomp, error);
+	itask = conv_ECalComponentWithTZ_to_I_task(ecalcomp, error);
 	/* create kolab mail if success */
 	if (*error == NULL)
 		kmail = conv_I_task_to_kolab_conv_mail(&itask, error);
@@ -423,10 +435,12 @@ kolabconv_etask_to_ktask (const ECalComponentWithTZ* ecalcomp, GError** error)
 ECalComponentWithTZ*
 kolabconv_knote_to_enote (const Kolab_conv_mail* kmail, GError** error)
 {
-	log_kolab_mail("input data:", kmail);
 	ECalComponentWithTZ *enote = NULL;
+	I_note *inote = NULL;
+	
+	log_kolab_mail("input data:", kmail);
 	/* create internal pim struct */
-	I_note *inote = conv_kolab_conv_mail_to_I_note(kmail, error);
+	inote = conv_kolab_conv_mail_to_I_note(kmail, error);
 	/* create evolution pim object if success */
 	if (*error == NULL)
 		enote = conv_I_note_to_ECalComponentWithTZ(&inote, error);
@@ -450,10 +464,12 @@ kolabconv_knote_to_enote (const Kolab_conv_mail* kmail, GError** error)
 Kolab_conv_mail*
 kolabconv_enote_to_knote (const ECalComponentWithTZ* ecalcomp, GError** error)
 {
-	log_evolution_ical("input data:", ecalcomp);
 	Kolab_conv_mail *kmail = NULL;
+	I_note *inote = NULL;
+	
+	log_evolution_ical("input data:", ecalcomp);
 	/* create internal pim struct */
-	I_note *inote = conv_ECalComponentWithTZ_to_I_note(ecalcomp, error);
+	inote = conv_ECalComponentWithTZ_to_I_note(ecalcomp, error);
 	/* create kolab mail if success */
 	if (*error == NULL)
 		kmail = conv_I_note_to_kolab_conv_mail(&inote, error);
diff --git a/src/libekolabconv/main/src/kolab/contact-i-to-k.c b/src/libekolabconv/main/src/kolab/contact-i-to-k.c
index 68661de..b700c95 100644
--- a/src/libekolabconv/main/src/kolab/contact-i-to-k.c
+++ b/src/libekolabconv/main/src/kolab/contact-i-to-k.c
@@ -43,12 +43,12 @@ static gchar *phone_type_i_to_k(Icontact_phone_type i_phone_type);
 Kolab_conv_mail*
 conv_I_contact_to_kolab_conv_mail (I_contact **i_contact, GError **error)
 {
+	GList *kolab_conv_mail_list = NULL;
+
 	g_assert(error != NULL && *error == NULL);
 
 	log_debug ("\nconv_I_contact_to_kolab_conv_mail(): convert I_contact to Kolab_conv_mail.");
 
-	GList* kolab_conv_mail_list = NULL;
-
 	if (*i_contact)
 		kolab_conv_mail_list = process_contact_i_to_k (i_contact);
 
@@ -280,8 +280,9 @@ i_contact_to_xml (const I_contact* i_contact)
 	if (i_contact->latitude >= -90 && i_contact->latitude <= 90
 			&& i_contact->longitude >= -180 && i_contact->longitude <= 180) {
 		gchar *lat = g_strdup_printf("%.16f", i_contact->latitude);
+		gchar *lon = NULL;
 		add_child_node(root_node, KLB_CNT_LATITUDE, lat);
-		gchar *lon = g_strdup_printf("%.16f", i_contact->longitude);
+		lon = g_strdup_printf("%.16f", i_contact->longitude);
 		add_child_node(root_node, KLB_CNT_LONGITUDE, lon);
 		g_free(lat);
 		g_free(lon);
diff --git a/src/libekolabconv/main/src/kolab/contact-k-to-i.c b/src/libekolabconv/main/src/kolab/contact-k-to-i.c
index e469008..4f72a4d 100644
--- a/src/libekolabconv/main/src/kolab/contact-k-to-i.c
+++ b/src/libekolabconv/main/src/kolab/contact-k-to-i.c
@@ -68,19 +68,22 @@ static Icontact_phone_type phone_type_k_to_icontact(gchar *k_phone_type);
 I_contact*
 conv_kolab_conv_mail_to_I_contact (const Kolab_conv_mail* k_contact, GError** error)
 {
+	I_contact *i_contact = NULL;
+	xmlNodePtr node = NULL, n_ptr;
+	xmlDocPtr doc = NULL;
+	
 	log_debug ("\nconv_kolab_conv_mail_to_I_contact(): convert Kolab_conv_mail to I_contact.");
 
 	if (*error != NULL)
 		return NULL;
 	/* get parsed kolab XML */
-	I_contact *i_contact = new_i_contact ();
-	xmlDocPtr doc = util_get_kolab_xml_part(k_contact, &i_contact->common->kolab_attachment_store, error);
+	i_contact = new_i_contact ();
+	doc = util_get_kolab_xml_part(k_contact, &i_contact->common->kolab_attachment_store, error);
 
 	if (*error != NULL)
 		return NULL;
 
 	/* find root node */
-	xmlNodePtr node = NULL, n_ptr;
 	for (n_ptr = doc->children; n_ptr != NULL; n_ptr = n_ptr->next)
 		if (n_ptr->type == XML_ELEMENT_NODE &&
 				g_strcmp0((gchar*)n_ptr->name, KLB_CNT) == 0)
@@ -156,10 +159,12 @@ process_contact_k_to_i (I_contact *i_contact, const xmlNodePtr node, GError** er
 static void
 process_attachments_k_to_i (I_contact* i_contact, GError** error)
 {
+	GList *attach = NULL;
+	
 	g_assert(error != NULL && *error == NULL);
 	/* iteration of kolabXmlMailArray for adding attachments */
 
-	GList *attach = i_contact->common->kolab_attachment_store;
+	attach = i_contact->common->kolab_attachment_store;
 	while (attach) {
 		Kolab_conv_mail_part *mail_part = attach->data;
 
@@ -244,10 +249,12 @@ handle_sensitivity(I_contact *i_contact, xmlNodePtr node)
 static gboolean
 handle_picture_name (I_contact *i_contact, xmlNodePtr node)
 {
+	gchar *picture_name = NULL;
+	
 	if (strcmp ((gchar*) node->name, KLB_CNT_PICTURE) != 0)
 		return FALSE;	/* Not a photo_name node */
 
-	char* picture_name = xml_get_node_text(node);
+	picture_name = xml_get_node_text(node);
 
 	/* create mail part and set name if not empty */
 	if (*picture_name) {
@@ -268,12 +275,16 @@ handle_picture_name (I_contact *i_contact, xmlNodePtr node)
 static gboolean
 handle_element_custom (I_contact *i_contact, const xmlNodePtr node)
 {
-	if (strcmp ((gchar*) node->name, KLBX_CNT_X_CUSTOM_LIST) != 0)
-		return FALSE;
-
 	xmlChar* node_value = NULL;
 	xmlChar* node_app = NULL;
 	xmlChar* node_name = NULL;
+	gchar *str = NULL;
+	gchar *delim = "\356\200\200";	/* î separator written by Kontact (=EE=84=A0) */
+	gchar **tokens = NULL;
+	gint i;
+	
+	if (strcmp ((gchar*) node->name, KLBX_CNT_X_CUSTOM_LIST) != 0)
+		return FALSE;
 
 	if (xmlHasProp (node, (xmlChar*) KLBX_CNT_X_CUSTOM_VALUE))
 		node_value = xmlGetProp (node, (xmlChar*) KLBX_CNT_X_CUSTOM_VALUE);
@@ -285,11 +296,9 @@ handle_element_custom (I_contact *i_contact, const xmlNodePtr node)
 	/* split value string if delimiter is available
 	 * Kontact saves values of datasets from the same type in same xml tag value with delimiter
 	 */
-	gchar *str = (gchar*)node_value;
-	gchar *delim = "\356\200\200";	/* î separator written by Kontact (=EE=84=A0) */
+	str = (gchar*)node_value;
+	tokens = str_split(str, delim);
 
-	gchar **tokens = str_split(str, delim);
-	gint i;
 	for (i = 0; tokens[i]; ++i) {
 		/* Add a new custom field to the contact object member custom_list */
 		Custom *custom_field = g_new (Custom, 1);
@@ -326,16 +335,17 @@ handle_element_custom (I_contact *i_contact, const xmlNodePtr node)
 static gboolean
 handle_element_phone (I_contact *i_contact, const xmlNodePtr node)
 {
-	if (strcmp ((gchar*) node->name, KLB_CNT_PHONE_LIST) != 0)
-		return FALSE;
-
 	const guint max_numbers = 8; /* maximum values that can be shown by evolution, remaining numbers in kolab-store */
-
-	xmlNodePtr text = node->children;
+	xmlNodePtr text = NULL;
 	xmlNodePtr child = NULL;
 	xmlNodePtr child_contents = NULL;
+	Phone_number *phone_nr = NULL;
 
-	Phone_number *phone_nr = g_new0 (Phone_number, 1);
+	if (strcmp ((gchar*) node->name, KLB_CNT_PHONE_LIST) != 0)
+		return FALSE;
+
+	text = node->children;
+	phone_nr = g_new0 (Phone_number, 1);
 
 	do {
 		child = text->next;
@@ -355,6 +365,7 @@ handle_element_phone (I_contact *i_contact, const xmlNodePtr node)
 	if (phone_nr->type == ICONTACT_PHONE_BUSINESS_2 || phone_nr->type == ICONTACT_PHONE_HOME_2) {
 		/* if type that has to be saved a two nodes, there must be 2 free places in array */
 		if (g_list_length(i_contact->phone_numbers) < max_numbers-1) {
+			Phone_number *primary_phone = NULL;
 
 			if (phone_nr->type == ICONTACT_PHONE_BUSINESS_2)	/* business 2 = business 1 & primary */
 				phone_nr->type = ICONTACT_PHONE_BUSINESS_1;
@@ -364,7 +375,7 @@ handle_element_phone (I_contact *i_contact, const xmlNodePtr node)
 			i_contact->phone_numbers = g_list_append (i_contact->phone_numbers, (Phone_number *) phone_nr);
 
 			/* additional primary node */							/* + primary */
-			Phone_number *primary_phone = g_new0 (Phone_number, 1);
+			primary_phone = g_new0 (Phone_number, 1);
 			primary_phone->type = ICONTACT_PHONE_PRIMARY;
 			primary_phone->number = g_strdup(phone_nr->number);
 			i_contact->phone_numbers = g_list_append (i_contact->phone_numbers, (Phone_number *) primary_phone);
@@ -398,17 +409,19 @@ handle_element_phone (I_contact *i_contact, const xmlNodePtr node)
 static gboolean
 handle_element_email (I_contact *i_contact, const xmlNodePtr node)
 {
+	xmlNodePtr text = NULL;
+	xmlNodePtr child = NULL;
+	xmlNodePtr child_contents = NULL;
+	Email *email = NULL;
+	
 	if (strcmp ((gchar*) node->name, KLB_CNT_EMAIL_LIST) != 0)
 		return FALSE;
 
 	if (g_list_length(i_contact->emails) >= 4)
 		return FALSE;
 
-	xmlNodePtr text = node->children;
-	xmlNodePtr child = NULL;
-	xmlNodePtr child_contents = NULL;
-
-	Email *email = g_new0 (Email, 1);
+	text = node->children;
+	email = g_new0 (Email, 1);
 
 	while (text != NULL && text->next != NULL) {
 
@@ -441,14 +454,16 @@ handle_element_email (I_contact *i_contact, const xmlNodePtr node)
 static gboolean
 handle_element_address (I_contact *i_contact, const xmlNodePtr node)
 {
+	Address *address = NULL;
+	xmlNodePtr text = NULL;
+	xmlNodePtr child = NULL;
+	xmlNodePtr child_contents = NULL;
+	
 	if (strcmp ((gchar*) node->name, KLB_CNT_ADDRESS_LIST) != 0)
 		return FALSE;
 
-	Address *address = g_new0 (Address, 1);
-
-	xmlNodePtr text = node->children;
-	xmlNodePtr child = NULL;
-	xmlNodePtr child_contents = NULL;
+	address = g_new0 (Address, 1);
+	text = node->children;
 
 	do {
 		child = text->next;
@@ -500,11 +515,12 @@ handle_element_address (I_contact *i_contact, const xmlNodePtr node)
 static gboolean
 handle_contact_name (I_contact *i_contact, xmlNodePtr node)
 {
+	xmlNodePtr n_ptr; /* used in for loop */
+
 	if (strcmp ((gchar*) node->name, KLB_CNT_NAME) != 0)
 		return FALSE;
 
 	/* iterate over all child elements of node an process them */
-	xmlNodePtr n_ptr; /* used in for loop */
 	for (n_ptr = node->children; n_ptr != NULL; n_ptr = n_ptr->next) {
 		if (n_ptr->type == XML_ELEMENT_NODE) {
 			if(
@@ -592,5 +608,3 @@ phone_type_k_to_icontact(gchar *k_phone_type)
 	else
 		return ICONTACT_PHONE_PRIMARY;
 }
-
-
diff --git a/src/libekolabconv/main/src/kolab/event-i-to-k.c b/src/libekolabconv/main/src/kolab/event-i-to-k.c
index d8dca10..03f6629 100644
--- a/src/libekolabconv/main/src/kolab/event-i-to-k.c
+++ b/src/libekolabconv/main/src/kolab/event-i-to-k.c
@@ -38,11 +38,11 @@ static gchar *show_time_as_to_kolab_string (Show_time_as show_time_as);
 Kolab_conv_mail*
 conv_I_event_to_kolab_conv_mail (I_event **i_event_ptr, GError **error)
 {
+	GList* mail_part_list = NULL;
+
 	g_assert(error != NULL && *error == NULL);
 	log_debug ("\nconv_I_event_to_kolab_conv_mail(): convert I_event to Kolab_conv_mail.");
 
-	GList* mail_part_list = NULL;
-
 	if (*i_event_ptr) {
 		I_event *i_event = *i_event_ptr;
 		Kolab_conv_mail_part *mail_part;
@@ -75,9 +75,10 @@ i_event_to_xml(const I_event *i_event)
 {
 	GString *xml_string = g_string_new("");
 
-	xmlNodePtr root_node;
-	xmlDocPtr doc;
-	xmlChar *xml_buf;
+	xmlNodePtr root_node = NULL;
+	xmlDocPtr doc = NULL;
+	xmlChar *xml_buf = NULL;
+	gchar *return_string = NULL;
 	gint buf_size;
 
 	doc = xmlNewDoc(BAD_CAST "1.0");
@@ -107,8 +108,7 @@ i_event_to_xml(const I_event *i_event)
 	xmlFree(xml_buf);
 	xmlFreeDoc(doc);
 
-	gchar *return_string = xml_string->str;
-	g_string_free(xml_string, FALSE);
+	return_string = g_string_free (xml_string, FALSE);
 	return return_string;
 }
 
diff --git a/src/libekolabconv/main/src/kolab/event-k-to-i.c b/src/libekolabconv/main/src/kolab/event-k-to-i.c
index f02c065..610bcab 100644
--- a/src/libekolabconv/main/src/kolab/event-k-to-i.c
+++ b/src/libekolabconv/main/src/kolab/event-k-to-i.c
@@ -61,19 +61,22 @@ static gboolean handle_element_event(I_event *i_event, xmlNodePtr node, GError *
 I_event*
 conv_kolab_conv_mail_to_I_event (const Kolab_conv_mail *k_event, GError **error)
 {
+	I_event *ievent = NULL;
+	xmlNodePtr node = NULL, n;
+	xmlDocPtr doc = NULL;
+	
 	log_debug ("\nconv_kolab_conv_mail_to_I_event(): convert Kolab_conv_mail to I_event.");
 
 	if (*error != NULL)
 		return NULL;
 	/* get parsed kolab XML */
-	I_event *ievent = new_i_event ();
-	xmlDocPtr doc = util_get_kolab_xml_part(k_event, &ievent->incidence->common->kolab_attachment_store, error);
+	ievent = new_i_event ();
+	doc = util_get_kolab_xml_part(k_event, &ievent->incidence->common->kolab_attachment_store, error);
 	if (*error != NULL)
 		return NULL;
 
 
 	/* find root node */
-	xmlNodePtr node = NULL, n;
 	for (n = doc->children; n != NULL; n = n->next)
 		if (n->type == XML_ELEMENT_NODE && g_strcmp0((gchar*)n->name, KLB_EVENT) == 0)
 			node = n;
@@ -110,6 +113,7 @@ read_event(I_event *ievent, xmlNodePtr node, GError **error)
 	xmlNodePtr n_ptr; /* used in for loop */
 	for (n_ptr = node->children; n_ptr != NULL; n_ptr = n_ptr->next) {
 		if (n_ptr->type == XML_ELEMENT_NODE) {
+			gboolean node_processed = FALSE;
 
 			/* save recurrence node in case recurrence has to be
 			 * stored in kolabstore due to missing start_date
@@ -117,7 +121,7 @@ read_event(I_event *ievent, xmlNodePtr node, GError **error)
 			if (strcmp ((gchar*) node->name, KLB_INC_RECURRENCE) == 0)
 				rec_ptr = node;
 
-			gboolean node_processed = handle_element_event(ievent, n_ptr, error);
+			node_processed = handle_element_event(ievent, n_ptr, error);
 			if (*error != NULL)
 				return;
 			if (!node_processed)
@@ -149,10 +153,12 @@ read_event(I_event *ievent, xmlNodePtr node, GError **error)
 static gboolean
 handle_element_show_time_as (I_event *i_event, xmlNodePtr node)
 {
+	gchar *value = NULL;
+	
 	if (g_strcmp0((gchar*) node->name, KLB_EVENT_SHOW_TIME_AS) != 0)
 		return FALSE;
 
-	gchar *value = xml_get_node_text(node);
+	value = xml_get_node_text(node);
 	if (g_strcmp0((gchar*) value, KLB_EVENT_SHOW_TIME_AS_FREE) == 0)
 		i_event->show_time_as = SHOW_TIME_AS_FREE;
 	else if (g_strcmp0((gchar*) value, KLB_EVENT_SHOW_TIME_AS_TENTATIVE) == 0)
diff --git a/src/libekolabconv/main/src/kolab/kolab-util.c b/src/libekolabconv/main/src/kolab/kolab-util.c
index 7e96e11..ab75307 100644
--- a/src/libekolabconv/main/src/kolab/kolab-util.c
+++ b/src/libekolabconv/main/src/kolab/kolab-util.c
@@ -134,6 +134,9 @@ datetime_to_string (const time_t *time, gchar *date_string)
 xmlDocPtr
 util_get_kolab_xml_part(const Kolab_conv_mail *klb_mail, GList **other_parts, GError **error)
 {
+	xmlDocPtr doc = NULL;
+	guint i;
+	
 	/* check input paramters */
 	if (klb_mail == NULL) {
 		g_set_error(error, KOLABCONV_ERROR_READ_KOLAB,
@@ -142,8 +145,6 @@ util_get_kolab_xml_part(const Kolab_conv_mail *klb_mail, GList **other_parts, GE
 		return NULL;
 	}
 	/* iterate over mail parts, search kolab xml part, parse and return it */
-	xmlDocPtr doc = NULL;
-	guint i;
 	for (i = 0; i < klb_mail->length; i++) {
 		Kolab_conv_mail_part *mail_part = klb_mail->mail_parts + i;
 		if (g_str_has_prefix(mail_part->mime_type, KOLAB_MESSAGE_MIMETYPE_PREFIX)) {
@@ -209,10 +210,11 @@ xml_get_boolean(xmlNodePtr node)
 gboolean
 handle_element_GList_String (gchar* list_name, gchar* element_name, GList **store_string_list, xmlNodePtr node)
 {
+	xmlNodePtr element_node = NULL; /* used in for loop */
+
 	if (g_strcmp0 ((gchar *) node->name, list_name) != 0)
 		return FALSE;
 
-	xmlNodePtr element_node; /* used in for loop */
 	for (element_node = node->children; element_node != NULL; element_node = element_node->next) {
 		if (element_node->type == XML_ELEMENT_NODE) {
 			if (g_strcmp0 ((gchar *) element_node->name, element_name) == 0) {
@@ -304,12 +306,14 @@ handle_element_string (gchar* name, GString **store, xmlNodePtr node)
 gboolean
 handle_element_integer (gchar* name, gint *store, xmlNodePtr node)
 {
+	gchar *value = NULL;
+	gchar *p = NULL;
+	
 	if (g_strcmp0 ((gchar *) node->name, name) != 0)
 		return FALSE;
 
-	gchar *value = xml_get_node_text(node);
+	value = xml_get_node_text(node);
 	g_debug ("**** handle_element_integer() node: %s - value: %s", node->name, value);
-	gchar *p;
 	errno = 0;
 	*store = strtol(value, &p, 10);
 	if (errno != 0 || *p != 0 || p == value)
@@ -320,12 +324,14 @@ handle_element_integer (gchar* name, gint *store, xmlNodePtr node)
 gboolean
 handle_element_double (gchar* name, gdouble *store, xmlNodePtr node)
 {
+	gchar *value = NULL;
+	gchar *p = NULL;
+	
 	if (g_strcmp0 ((gchar *) node->name, name) != 0)
 		return FALSE;
 
-	gchar *value = xml_get_node_text(node);
+	value = xml_get_node_text(node);
 	g_debug ("**** handle_element_double() node: %s - value: %s", node->name, value);
-	gchar *p;
 	errno = 0;
 	*store = strtod(value, &p);
 	if (errno != 0 || *p != 0 || p == value)
@@ -336,16 +342,16 @@ handle_element_double (gchar* name, gdouble *store, xmlNodePtr node)
 gboolean
 handle_element_date (gchar* name, GDate** store, xmlNodePtr node)
 {
+	GDate* date = NULL;
+	gchar* value = NULL;
+	gchar** date_tokens = NULL;
+	gint day = 0, month = 0, year = 0;
+
 	if (g_strcmp0 ((gchar *) node->name, name) != 0)
 		return FALSE;
 
-	GDate* date;
-
-	gchar* value = xml_get_node_text(node);
-
-	gchar** date_tokens = g_strsplit (value, "-", -1);
-
-	gint day = 0, month = 0, year = 0;
+	value = xml_get_node_text(node);
+	date_tokens = g_strsplit (value, "-", -1);
 
 	year = strtol(date_tokens[0], NULL, 10);
 	month = strtol(date_tokens[1], NULL, 10);
@@ -360,11 +366,11 @@ handle_element_date (gchar* name, GDate** store, xmlNodePtr node)
 	return TRUE;
 }
 
-
-
 gboolean
 handle_element_date_or_datetime (gchar* name, Date_or_datetime** store, xmlNodePtr node)
 {
+	gchar *value = NULL;
+	
 	if (g_strcmp0 ((gchar *) node->name, name) != 0)
 		return FALSE;
 
@@ -376,18 +382,19 @@ handle_element_date_or_datetime (gchar* name, Date_or_datetime** store, xmlNodeP
 	else
 		*store = g_new0(Date_or_datetime, 1);
 
-	gchar *value = xml_get_node_text(node);
+	value = xml_get_node_text(node);
 
 	g_debug ("**** handle_element_date_or_datetime() node: %s - value: '%s'", node->name, value);
 
 	if (strlen (value) < 12) {
+		gint day = 0, month = 0, year = 0;
+
 		/* Populate only date */
 		gchar** date_tokens = g_strsplit (value, "-", -1);
 		if (*date_tokens == NULL) {
 			*store = NULL;
 			return TRUE;
 		}
-		gint day = 0, month = 0, year = 0;
 
 		year = strtol(date_tokens[0], NULL, 10);
 		month = strtol(date_tokens[1], NULL, 10);
@@ -399,14 +406,16 @@ handle_element_date_or_datetime (gchar* name, Date_or_datetime** store, xmlNodeP
 		g_strfreev(date_tokens);
 
 	} else {
+		struct tm t;
+		time_t tt;
+		
 		/* convert string to 'struct tm' */
 		if (value[10] == 'T') /* remove 'T' in iso timestamp if neccessary */
 		        value[10] = ' ';
 
-		struct tm t;
 		strptime(value, "%Y-%m-%d %H:%M:%S", &t); /* string to tm */
 
-		time_t tt = time_gm(&t); /* tm to seconds */
+		tt = time_gm(&t); /* tm to seconds */
 
 		g_debug ("**** handle_element_date_or_datetime() tt: '%lu'", tt);
 
@@ -421,7 +430,11 @@ handle_element_date_or_datetime (gchar* name, Date_or_datetime** store, xmlNodeP
 
 
 gboolean
-handle_element_datetime (gchar* name, time_t** store, xmlNodePtr node) {
+handle_element_datetime (gchar* name, time_t** store, xmlNodePtr node)
+{
+	gchar *value = NULL;
+	struct tm t;
+	
 	if (g_strcmp0 ((gchar *) node->name, name) != 0)
 		return FALSE;
 
@@ -433,13 +446,12 @@ handle_element_datetime (gchar* name, time_t** store, xmlNodePtr node) {
 	else
 		*store = g_new0(time_t, 1);
 
-	gchar *value = xml_get_node_text(node);
+	value = xml_get_node_text(node);
 
 	/* convert string to 'struct tm' */
 	if (value[10] == 'T') /* remove 'T' in iso timestamp if neccessary */
 		value[10] = ' ';
 
-	struct tm t;
 	strptime(value, "%Y-%m-%d %H:%M:%S", &t); /* string to tm */
 
 	**store = time_gm(&t); /* tm to seconds */
@@ -470,16 +482,17 @@ void convert_GList_String_to_xmlNodes (GList *string_list, char* node_name, xmlN
 gchar*
 convert_xmlNode_to_String (const xmlNodePtr node)
 {
-	xmlDocPtr doc;
-	xmlChar *xmlbuff;
+	xmlDocPtr doc = NULL;
+	xmlChar *xmlbuff = NULL;
 	gint buffersize;
+	gchar *xmlStr = NULL;
 
 	doc = xmlNewDoc(BAD_CAST "1.0");
 
 	xmlDocSetRootElement (doc, xmlCopyNode (node, 1));
 
 	xmlDocDumpFormatMemoryEnc (doc, &xmlbuff, &buffersize, "UTF-8", 1);
-	gchar *xmlStr = g_strdup((gchar*) xmlbuff);
+	xmlStr = g_strdup((gchar*) xmlbuff);
 
 	xmlFree (xmlbuff);
 	xmlFreeDoc (doc);
@@ -515,9 +528,10 @@ printKolabXmlMailPartArray(const GList* kolabconvMailArray)
 {
 
 	const GList *iterator = kolabconvMailArray;
+	gint i=1;
 
 	log_debug("\n*********************Printing kolabXmlmailArray:***************************");
-	gint i=1;
+
 	while(iterator != NULL){
 		log_debug("\n\nFile no. %d", i);
 		/* log_debug("\n\tOrder: %d", ((Kolab_conv_mail_part*)iterator->data)->order  ); */
@@ -538,6 +552,7 @@ printKolabXmlMailPartArray(const GList* kolabconvMailArray)
 void
 printXMLTree (xmlNodePtr node, int depth)
 {
+	xmlNodePtr children;
 	gint i = 0;
 
 	log_debug ("\n");
@@ -549,12 +564,9 @@ printXMLTree (xmlNodePtr node, int depth)
 	if (node->content != NULL)
 		log_debug (" & Node-content: %s", node->content);
 
-	xmlNodePtr children;
-
 	for (children = node->children; children != NULL; children = children->next) {
 		printXMLTree (children, depth + 1);
 	}
-
 }
 
 
@@ -656,4 +668,3 @@ gint priority_xkcal_to_k(gint xkcal_prio) {
 		default: return 3;
 	}
 }
-
diff --git a/src/libekolabconv/main/src/kolab/note-i-to-k.c b/src/libekolabconv/main/src/kolab/note-i-to-k.c
index 518fabe..7133c69 100644
--- a/src/libekolabconv/main/src/kolab/note-i-to-k.c
+++ b/src/libekolabconv/main/src/kolab/note-i-to-k.c
@@ -40,11 +40,11 @@ static GList *i_note_to_xml_mail_part (I_note **i_note_ptr);
 Kolab_conv_mail*
 conv_I_note_to_kolab_conv_mail (I_note **i_note, GError **error)
 {
+	GList* kolab_conv_mail_list = NULL;
+
 	g_assert(error != NULL && *error == NULL);
 	log_debug ("\nconv_I_note_to_kolab_conv_mail(): convert I_note to Kolab_conv_mail.");
 
-	GList* kolab_conv_mail_list = NULL;
-
 	if (*i_note)
 		kolab_conv_mail_list = i_note_to_xml_mail_part(i_note);
 
diff --git a/src/libekolabconv/main/src/kolab/note-k-to-i.c b/src/libekolabconv/main/src/kolab/note-k-to-i.c
index 01e8822..396a769 100644
--- a/src/libekolabconv/main/src/kolab/note-k-to-i.c
+++ b/src/libekolabconv/main/src/kolab/note-k-to-i.c
@@ -85,16 +85,19 @@ read_note(I_note *i_note, xmlNodePtr node, GError **error)
 I_note*
 conv_kolab_conv_mail_to_I_note (const Kolab_conv_mail *knote, GError **error)
 {
+	I_note *i_note = NULL;
+	xmlDocPtr doc = NULL;
+	xmlNodePtr node = NULL, n;
+	
 	log_debug ("\nconv_kolab_conv_mail_to_I_note(): convert Kolab_conv_mail to I_note.");
 
 	if (*error != NULL)
 		return NULL;
 
 	/* get parsed kolab XML */
-	I_note *i_note = new_i_note();
-	xmlDocPtr doc = util_get_kolab_xml_part(knote, &i_note->common->kolab_attachment_store, error);
+	i_note = new_i_note();
+	doc = util_get_kolab_xml_part(knote, &i_note->common->kolab_attachment_store, error);
 	/* find root node */
-	xmlNodePtr node = NULL, n;
 	for (n = doc->children; n != NULL; n = n->next)
 		if (n->type == XML_ELEMENT_NODE && strcmp ((gchar*)n->name, KLB_NOTE) == 0)
 			node = n;
diff --git a/src/libekolabconv/main/src/kolab/priv-common-i-to-k.c b/src/libekolabconv/main/src/kolab/priv-common-i-to-k.c
index 56c616a..1d1cc47 100644
--- a/src/libekolabconv/main/src/kolab/priv-common-i-to-k.c
+++ b/src/libekolabconv/main/src/kolab/priv-common-i-to-k.c
@@ -121,6 +121,8 @@ recurrence_weekday_i_to_k(Week_day weekday)
 void
 common_i_to_k(xmlNodePtr root_node, I_common *i_common)
 {
+	GList *lsl = NULL;
+	
 	if (i_common == NULL)
 		return;
 	/* Construct children of root node. */
@@ -149,7 +151,7 @@ common_i_to_k(xmlNodePtr root_node, I_common *i_common)
 	if(i_common->is_html_richtext)
 		add_child_node(root_node, KLBX_CMN_RICHTEXT, i_common->is_html_richtext == TRUE ? "true" : "false" );
 	/* add link attachments to the kolab xml */
-	GList *lsl = i_common->link_attachments;
+	lsl = i_common->link_attachments;
 	for (; lsl; lsl=lsl->next)
 		add_child_node(root_node, KLB_CMN_LINK_ATTACHMENT, (gchar*)lsl->data);
 	/* add inline attachment names to the kolab xml */
diff --git a/src/libekolabconv/main/src/kolab/priv-common-k-to-i.c b/src/libekolabconv/main/src/kolab/priv-common-k-to-i.c
index 7532208..774454d 100644
--- a/src/libekolabconv/main/src/kolab/priv-common-k-to-i.c
+++ b/src/libekolabconv/main/src/kolab/priv-common-k-to-i.c
@@ -44,10 +44,12 @@
 static gboolean
 handle_element_sensitivity (I_common *icommon, const xmlNodePtr node)
 {
+	gchar *value = NULL;
+	
 	if (strcmp ((gchar*) node->name, KLB_CMN_SENSITIVITY) != 0)
 		return FALSE;
 
-	gchar *value = xml_get_node_text(node);
+	value = xml_get_node_text(node);
 	if (strcmp ((gchar*) value, KLB_CMN_SENSITIVITY_PUBLIC) == 0)
 		icommon->sensitivity = ICOMMON_SENSITIVITY_PUBLIC;
 	else if (strcmp ((gchar*) value, KLB_CMN_SENSITIVITY_PRIVATE) == 0)
@@ -68,10 +70,12 @@ handle_element_sensitivity (I_common *icommon, const xmlNodePtr node)
 static gboolean
 handle_element_inline_attachment(I_common *icommon, const xmlNodePtr node)
 {
+	gchar *value = NULL;
+	
 	if (strcmp ((gchar*) node->name, KLB_CMN_INLINE_ATTACHMENT) != 0)
 		return FALSE;
 
-	gchar *value = xml_get_node_text(node);
+	value = xml_get_node_text(node);
 	value = g_strdup(value);
 	icommon->inline_attachment_names = g_list_append(icommon->inline_attachment_names, value);
 	return TRUE;
@@ -83,10 +87,12 @@ handle_element_inline_attachment(I_common *icommon, const xmlNodePtr node)
 static gboolean
 handle_element_link_attachment(I_common *icommon, const xmlNodePtr node)
 {
+	gchar *value = NULL;
+	
 	if (strcmp ((gchar*) node->name, KLB_CMN_LINK_ATTACHMENT) != 0)
 		return FALSE;
 
-	gchar *value = xml_get_node_text(node);
+	value = xml_get_node_text(node);
 	value = g_strdup(value);
 	icommon->link_attachments = g_list_append(icommon->link_attachments, value);
 	return TRUE;
diff --git a/src/libekolabconv/main/src/kolab/priv-incidence-i-to-k.c b/src/libekolabconv/main/src/kolab/priv-incidence-i-to-k.c
index cb3dbce..331d328 100644
--- a/src/libekolabconv/main/src/kolab/priv-incidence-i-to-k.c
+++ b/src/libekolabconv/main/src/kolab/priv-incidence-i-to-k.c
@@ -42,6 +42,9 @@ static void recurrence_i_to_k(const Recurrence *recurrence, xmlNodePtr node);
 void
 conv_incidence_i_to_k(xmlNodePtr root_node, I_incidence *i_incidence)
 {
+	xmlNodePtr node = NULL;
+	GList *iterator = NULL;
+	
 	if (i_incidence == NULL)
 		return;
 
@@ -56,8 +59,6 @@ conv_incidence_i_to_k(xmlNodePtr root_node, I_incidence *i_incidence)
 	if(i_incidence->location)
 		add_child_node(root_node, KLB_INC_LOCATION, i_incidence->location->str );
 
-	xmlNodePtr node;
-
 	/* organizer */
 	node = add_child_node(root_node, KLB_INC_ORGANIZER, NULL); /* always write organizer node because kolab store could hold sub elements */
 	if (i_incidence->organizer_display_name )
@@ -75,11 +76,12 @@ conv_incidence_i_to_k(xmlNodePtr root_node, I_incidence *i_incidence)
 	}
 	/* advanced_alarm */
 	if (i_incidence->advanced_alarm) {
+		GList *iterator = NULL;
+
 		xmlNodePtr simple_alarm_node;
 		simple_alarm_node = add_child_node(root_node, KLB_INC_ALARM, NULL);
 		node = add_child_node(root_node, KLBX_INC_ADV_ALARM, NULL);
 
-		GList *iterator;
 		iterator = i_incidence->advanced_alarm;
 
 		while (iterator != NULL) {
@@ -129,10 +131,10 @@ conv_incidence_i_to_k(xmlNodePtr root_node, I_incidence *i_incidence)
 					if (alarm_element->type == I_ALARM_TYPE_EMAIL) {
 						if (alarm_element->email_param) {
 							if (alarm_element->email_param->addresses) {
-								xmlNodePtr addresses_node;
+								GList *address_iterator = NULL;
+								xmlNodePtr addresses_node = NULL;
 								addresses_node = add_child_node(element_node, KLBX_INC_ADV_ALARM_TYPE_EMAIL_ADDRESSES, NULL);
 
-								GList *address_iterator;
 								address_iterator = alarm_element->email_param->addresses;
 
 								while(address_iterator != NULL){
@@ -207,7 +209,6 @@ conv_incidence_i_to_k(xmlNodePtr root_node, I_incidence *i_incidence)
 	}
 
 	/* attendee */
-	GList *iterator;
 	iterator = i_incidence->attendee;
 
 	while (iterator != NULL) {
@@ -369,6 +370,15 @@ weekday_i_to_k (xmlNodePtr node, gint weekdays)
 static void
 recurrence_i_to_k(const Recurrence *recurrence, xmlNodePtr node)
 {
+	gchar *dnstr = NULL;
+	gchar *daynr_str = NULL;
+	gchar *monthStr = NULL;
+	gchar *monthStr_ = NULL;
+	gchar *date_str = NULL;
+	gchar *nbr_str = NULL;
+	xmlNodePtr n_range = NULL;
+	GList *exclusion_list = NULL;
+
 	if (recurrence->interval != -1) {
 		gchar *ristr = g_strdup_printf ("%d", recurrence->interval);
 		add_child_node(node, KLB_INC_RCR_INTERVAL, ristr);
@@ -387,7 +397,7 @@ recurrence_i_to_k(const Recurrence *recurrence, xmlNodePtr node)
 		case I_REC_CYCLE_MONTHLY_DAYNUMBER:
 			add_property(node, KLB_INC_RCR_CYCLE, "monthly");
 			add_property(node, KLB_INC_RCR_CYCLETYPE, "daynumber");
-			gchar *dnstr = g_strdup_printf ("%d", recurrence->day_number);
+			dnstr = g_strdup_printf ("%d", recurrence->day_number);
 			add_child_node(node, KLB_INC_RCR_DAYNUMBER, dnstr);
 			g_free(dnstr);
 			break;
@@ -404,7 +414,7 @@ recurrence_i_to_k(const Recurrence *recurrence, xmlNodePtr node)
 			dnstr = g_strdup_printf ("%d", recurrence->day_number);
 			add_child_node(node, KLB_INC_RCR_DAYNUMBER, dnstr);
 			g_free(dnstr);
-			gchar *monthStr = recurrence_month_i_to_k(recurrence->month);
+			monthStr = recurrence_month_i_to_k(recurrence->month);
 			add_child_node(node, KLB_INC_RCR_MONTH, monthStr);
 			break;
 		case I_REC_CYCLE_YEARLY_YEARDAY:
@@ -417,32 +427,32 @@ recurrence_i_to_k(const Recurrence *recurrence, xmlNodePtr node)
 		case I_REC_CYCLE_YEARLY_WEEKDAY:
 			add_property(node, KLB_INC_RCR_CYCLE, "yearly");
 			add_property(node, KLB_INC_RCR_CYCLETYPE, "weekday");
-			gchar *daynr_str = g_strdup_printf ("%d", recurrence->day_number);
+			daynr_str = g_strdup_printf ("%d", recurrence->day_number);
 			add_child_node(node, KLB_INC_RCR_DAYNUMBER, daynr_str);
 			g_free(daynr_str);
-			gchar *monthStr_ = recurrence_month_i_to_k(recurrence->month);
+			monthStr_ = recurrence_month_i_to_k(recurrence->month);
 			add_child_node(node, KLB_INC_RCR_MONTH, monthStr_);
 			break;
 		default:
 			log_debug("illegal recurrence cycle %d: ", recurrence->recurrence_cycle);
 	}
 
-	xmlNodePtr n_range = add_child_node(node, KLB_INC_RCR_RANGE, NULL);
+	n_range = add_child_node(node, KLB_INC_RCR_RANGE, NULL);
 
 	if (recurrence->range_date != NULL) {
 		add_property(n_range, KLB_INC_RCR_RANGETYPE, KLB_INC_RCR_RANGETYPE_DATE);
-		gchar *date_str = g_date_to_string (recurrence->range_date);
+		date_str = g_date_to_string (recurrence->range_date);
 		xmlNodeSetContent(n_range, (xmlChar*) date_str);
 		g_free(date_str);
 	} else if (recurrence->range_number != NULL) {
 		add_property(n_range, KLB_INC_RCR_RANGETYPE, KLB_INC_RCR_RANGETYPE_NUMBER);
-		gchar *nbr_str = g_strdup_printf ("%d", *(recurrence->range_number));
+		nbr_str = g_strdup_printf ("%d", *(recurrence->range_number));
 		xmlNodeSetContent(n_range, (xmlChar*) nbr_str);
 		g_free(nbr_str);
 	} else
 		add_property(n_range, KLB_INC_RCR_RANGETYPE, KLB_INC_RCR_RANGETYPE_NONE);
 
-	GList *exclusion_list = recurrence->exclusion;
+	exclusion_list = recurrence->exclusion;
 	while (exclusion_list) {
 		GDate *excl_date = exclusion_list->data;
 		gchar *excl_string = g_date_to_string(excl_date);
diff --git a/src/libekolabconv/main/src/kolab/priv-incidence-k-to-i.c b/src/libekolabconv/main/src/kolab/priv-incidence-k-to-i.c
index 706c76c..40e6631 100644
--- a/src/libekolabconv/main/src/kolab/priv-incidence-k-to-i.c
+++ b/src/libekolabconv/main/src/kolab/priv-incidence-k-to-i.c
@@ -264,19 +264,20 @@ handle_incidence_alarm(I_incidence *incidence, xmlNodePtr node)
 static gboolean
 handle_incidence_advanced_alarm (I_incidence *incidence, xmlNodePtr node)
 {
+	xmlNodePtr alarm_node = NULL; /* used in for loop */
+
 	if (strcmp ((gchar *) node->name, KLBX_INC_ADV_ALARM) != 0)
 		return FALSE;
 
-	xmlNodePtr alarm_node; /* used in for loop */
 	for (alarm_node = node->children; alarm_node != NULL; alarm_node = alarm_node->next) {
 		if (alarm_node->type == XML_ELEMENT_NODE) {
 
 			if (strcmp ((gchar *) alarm_node->name, KLB_INC_ALARM) == 0) {
+				xmlNodePtr alarm_attribute = NULL; /* used in for loop */
 				gchar *type = (gchar *) xmlGetProp (alarm_node, (xmlChar *) KLBX_INC_ADV_ALARM_TYPE);
 				Alarm *adv_alarm = new_alarm(alarm_type_k_to_i(type));
 				g_free(type);
 
-				xmlNodePtr alarm_attribute; /* used in for loop */
 				for (alarm_attribute = alarm_node->children; alarm_attribute != NULL; alarm_attribute = alarm_attribute->next) {
 
 					if (alarm_attribute->type == XML_ELEMENT_NODE) {
@@ -376,10 +377,12 @@ handle_incidence_recurrence_cycle (xmlNodePtr node)
 static gboolean
 handle_incidence_recurrence_weekdays (guint *weekdays, xmlNodePtr node)
 {
+	gchar *value = NULL;
+	
 	if (strcmp ((gchar *) node->name, KLB_INC_RCR_DAY) != 0)
 		return FALSE;
 
-	gchar *value = xml_get_node_text(node);
+	value = xml_get_node_text(node);
 	*weekdays |= weekday_k_to_i(value);
 	return TRUE;
 }
@@ -395,10 +398,12 @@ handle_incidence_recurrence_weekdays (guint *weekdays, xmlNodePtr node)
 static gboolean
 handle_incidence_recurrence_month (Month *month, xmlNodePtr node)
 {
+	gchar *value = NULL;
+	
 	if (strcmp ((gchar *) node->name, KLB_INC_RCR_MONTH) != 0)
 		return FALSE;
 
-	gchar *value = xml_get_node_text(node);
+	value = xml_get_node_text(node);
 	*month = month_k_to_i(value);
 	return TRUE;
 }
@@ -414,11 +419,14 @@ handle_incidence_recurrence_month (Month *month, xmlNodePtr node)
 static gboolean
 handle_incidence_recurrence_exclusion (GList **exclusion_list, xmlNodePtr node)
 {
+	gchar *value = NULL;
+	GDate *date = NULL;
+	
 	if (strcmp ((gchar *) node->name, KLB_INC_RCR_EXCLUSION) != 0)
 		return FALSE;
 
-	gchar *value = xml_get_node_text(node);
-	GDate *date = string_to_g_date(value);
+	value = xml_get_node_text(node);
+	date = string_to_g_date(value);
 	*exclusion_list = g_list_append(*exclusion_list, date);
 	return TRUE;
 }
@@ -437,11 +445,13 @@ handle_incidence_recurrence_exclusion (GList **exclusion_list, xmlNodePtr node)
 static gboolean
 handle_incidence_recurrence_range (GDate **rdate, gint **rnumber, xmlNodePtr node)
 {
+	gchar *rtype = NULL;
+	
 	if (strcmp ((gchar *) node->name, KLB_INC_RCR_RANGE) != 0)
 		return FALSE;
 
 
-	gchar *rtype = (gchar *) xmlGetProp (node, (xmlChar *) KLB_INC_RCR_RANGETYPE);
+	rtype = (gchar *) xmlGetProp (node, (xmlChar *) KLB_INC_RCR_RANGETYPE);
 	if (rtype != NULL) {
 
 		gchar *value = xml_get_node_text(node);
@@ -481,6 +491,8 @@ handle_incidence_recurrence_range (GDate **rdate, gint **rnumber, xmlNodePtr nod
 static gboolean
 handle_incidence_recurrence (I_incidence *incidence, xmlNodePtr node)
 {
+	xmlNodePtr n = NULL; /* used in for loop */
+
 	if (strcmp ((gchar*) node->name, KLB_INC_RECURRENCE) != 0)
 		return FALSE;
 
@@ -496,7 +508,6 @@ handle_incidence_recurrence (I_incidence *incidence, xmlNodePtr node)
 	incidence->recurrence->recurrence_cycle = handle_incidence_recurrence_cycle(node);
 
 	/* iterate over all child elements of node an process them */
-	xmlNodePtr n; /* used in for loop */
 	for (n = node->children; n != NULL; n = n->next) {
 		if (n->type == XML_ELEMENT_NODE) {
 			if (handle_incidence_recurrence_weekdays((guint *) &incidence->recurrence->weekdays, n)
@@ -521,12 +532,14 @@ handle_incidence_recurrence (I_incidence *incidence, xmlNodePtr node)
 static gboolean
 handle_incidence_attendee(I_incidence *incidence, xmlNodePtr node)
 {
+	Attendee *attendee = NULL;
+	xmlNodePtr n = NULL; /* used in for loop */
+	
 	if (strcmp ((gchar*) node->name, KLB_INC_ATTENDEE) != 0)
 		return FALSE;
 
-	Attendee *attendee = g_new0(Attendee, 1);
+	attendee = g_new0(Attendee, 1);
 
-	xmlNodePtr n; /* used in for loop */
 	for (n = node->children; n != NULL; n = n->next) {
 		if (n->type == XML_ELEMENT_NODE) {
 			if (strcmp ((gchar *) n->name, KLB_INC_DISPLAY_NAME) == 0) {
@@ -568,10 +581,11 @@ handle_incidence_attendee(I_incidence *incidence, xmlNodePtr node)
 static gboolean
 handle_incidence_organizer (I_incidence *i_incidence, xmlNodePtr node)
 {
+	xmlNodePtr n = NULL; /* used in for loop */
+
 	if (strcmp ((gchar*) node->name, KLB_INC_ORGANIZER) != 0)
 		return FALSE;
 	/* iterate over all child elements of node an process them */
-	xmlNodePtr n; /* used in for loop */
 	for (n = node->children; n != NULL; n = n->next) {
 		if (n->type == XML_ELEMENT_NODE) {
 			if (handle_element_string(KLB_INC_DISPLAY_NAME, &i_incidence->organizer_display_name, n)
diff --git a/src/libekolabconv/main/src/kolab/priv-kolab-preserve.c b/src/libekolabconv/main/src/kolab/priv-kolab-preserve.c
index 2581ca4..ec6264d 100644
--- a/src/libekolabconv/main/src/kolab/priv-kolab-preserve.c
+++ b/src/libekolabconv/main/src/kolab/priv-kolab-preserve.c
@@ -46,11 +46,13 @@
 gboolean
 k_evo_store_get_all(I_common *i_common, xmlNodePtr node, GError **error)
 {
+	gchar *value = NULL;
+	
 	g_assert(error != NULL && *error == NULL);
 	if (strcmp ((gchar*) node->name, KLB_CMN_EVO_STORE) != 0)
 		return FALSE;
 
-	gchar *value = xml_get_node_text(node);
+	value = xml_get_node_text(node);
 	i_common->evolution_store = g_strdup(value);
 	return TRUE;
 }
@@ -98,10 +100,10 @@ void
 i_kolab_store_get_xml_nodes(I_common *i_common, gpointer parent_ptr, xmlNodePtr parent_node)
 {
 	GList* list = kolab_store_get_element_list(i_common, parent_ptr);
-
+	
 	while (list != NULL) {
+		xmlNodePtr node = NULL; /* used in for loop */
 		gchar * xml_str = ((gchar *) list->data);
-
 		xmlDocPtr xml_doc = xmlReadMemory (xml_str, (int) strlen (xml_str), "kolab.xml", NULL, 0);
 
 		if (xml_doc == NULL) {
@@ -110,7 +112,6 @@ i_kolab_store_get_xml_nodes(I_common *i_common, gpointer parent_ptr, xmlNodePtr
 			continue;
 		}
 
-		xmlNodePtr node; /* used in for loop */
 		for (node = xml_doc->children; node != NULL; node = node->next)
 			if (node->type == XML_ELEMENT_NODE)
 				break;
diff --git a/src/libekolabconv/main/src/kolab/task-i-to-k.c b/src/libekolabconv/main/src/kolab/task-i-to-k.c
index 105e7aa..12ec47c 100644
--- a/src/libekolabconv/main/src/kolab/task-i-to-k.c
+++ b/src/libekolabconv/main/src/kolab/task-i-to-k.c
@@ -71,6 +71,8 @@ i_task_to_xml (const I_task *i_task) {
 	conv_incidence_i_to_k(root_node, i_task->incidence);
 
 	if (i_task->priority >= 0 && i_task->priority <= 9) {
+		gchar *str = NULL;
+		
 		/* if a detailed priority value exists and is valid */
 
 		/* set detailed priority */
@@ -81,7 +83,7 @@ i_task_to_xml (const I_task *i_task) {
 		/* set normal priority from detailed priority
 		 * (necessary for valid kolab standard and kontact also writes both)
 		 */
-		gchar *str = g_strdup_printf("%i", priority_xkcal_to_k(i_task->priority));
+		str = g_strdup_printf("%i", priority_xkcal_to_k(i_task->priority));
 		add_child_node (root_node, KLB_TASK_PRIORITY, str);
 		g_free(str);
 	}
@@ -129,8 +131,8 @@ i_task_to_xml (const I_task *i_task) {
 Kolab_conv_mail*
 conv_I_task_to_kolab_conv_mail (I_task **i_task_ptr, GError **error)
 {
-	g_assert(error != NULL && *error == NULL);
 	GList* mail_part_list = NULL;
+	g_assert(error != NULL && *error == NULL);
 
 	if (*i_task_ptr) {
 		I_task *i_task = *i_task_ptr;
diff --git a/src/libekolabconv/main/src/kolab/task-k-to-i.c b/src/libekolabconv/main/src/kolab/task-k-to-i.c
index a222ca6..15a0580 100644
--- a/src/libekolabconv/main/src/kolab/task-k-to-i.c
+++ b/src/libekolabconv/main/src/kolab/task-k-to-i.c
@@ -52,15 +52,18 @@ gboolean handle_element_priority (gchar* name, gint *store, xmlNodePtr node);
 I_task*
 conv_kolab_conv_mail_to_I_task (const Kolab_conv_mail *k_task, GError **error)
 {
+	I_task *i_task = NULL;
+	xmlDocPtr doc = NULL;
+	xmlNodePtr node = NULL, n;
+	
 	if (*error != NULL)
 		return NULL;
 
 	/* get parsed kolab XML */
-	I_task *i_task = new_i_task();
-	xmlDocPtr doc = util_get_kolab_xml_part(k_task, &i_task->incidence->common->kolab_attachment_store, error);
+	i_task = new_i_task();
+	doc = util_get_kolab_xml_part(k_task, &i_task->incidence->common->kolab_attachment_store, error);
 
 	/* find root node */
-	xmlNodePtr node = NULL, n;
 	for (n = doc->children; n != NULL; n = n->next)
 		if (n->type == XML_ELEMENT_NODE && strcmp ((gchar*)n->name, KLB_TASK) == 0)
 			node = n;
@@ -96,13 +99,14 @@ read_task(I_task *i_task, xmlNodePtr task_node, GError **error)
 	xmlNodePtr node; /* used in for loop */
 	for (node = task_node->children; node != NULL; node = node->next) {
 		if (node->type == XML_ELEMENT_NODE) {
+			gboolean node_processed = FALSE;
 			/* save recurrence node in case recurrence has to be
 			 * stored in kolabstore due to missing start_date
 			 */
 			if (strcmp ((gchar*) node->name, KLB_INC_RECURRENCE) == 0)
 				rec_ptr = node;
 
-			gboolean node_processed = read_task_element(i_task, node, error);
+			node_processed = read_task_element(i_task, node, error);
 
 			if (*error != NULL)
 				return;
@@ -163,10 +167,12 @@ read_task_element(I_task *i_task, xmlNodePtr node, GError **error)
 static gboolean
 handle_element_status (I_task *i_task, xmlNodePtr node)
 {
+	gchar *value = NULL;
+	
 	if (strcmp ((gchar*) node->name, KLB_TASK_STATUS) != 0)
 		return FALSE;
 
-	gchar *value = xml_get_node_text(node);
+	value = xml_get_node_text(node);
 	if (strcmp ((gchar*) value, KLB_TASK_STATUS_NOT_STARTED) == 0)
 		i_task->status = I_TASK_NOT_STARTED;
 	else if (strcmp ((gchar*) value, KLB_TASK_STATUS_IN_PROGRESS) == 0)
@@ -190,12 +196,14 @@ handle_element_status (I_task *i_task, xmlNodePtr node)
 gboolean
 handle_element_priority (gchar* name, gint *store, xmlNodePtr node)
 {
+	gchar *value = NULL;
+	gchar *p = NULL;
+	
 	if (g_strcmp0 ((gchar *) node->name, name) != 0)
 		return FALSE;
 
-	gchar *value = xml_get_node_text(node);
+	value = xml_get_node_text(node);
 	g_debug ("**** handle_element_priority() node: %s - value: %s", node->name, value);
-	gchar *p;
 	if (*store == -1)	/* already set? */
 	{
 		errno = 0;
diff --git a/src/libekolabconv/main/src/structs/common.c b/src/libekolabconv/main/src/structs/common.c
index f877a1d..b5d4f5f 100644
--- a/src/libekolabconv/main/src/structs/common.c
+++ b/src/libekolabconv/main/src/structs/common.c
@@ -70,13 +70,15 @@ new_date_or_datetime()
 void
 kolab_store_add_element(I_common *i_common, gpointer parent_ptr, gchar *xml_str, gboolean reverse_order)
 {
+	GList *list = NULL;
+	
 	log_debug("add to kolab store: %d, %s", parent_ptr, xml_str);
 	if (i_common->kolab_store == NULL) { /* initialize kolab store */
 		/* g_direct_hash() : key pointers are used directly as hash value */
 		/* keys/values are not freed automatically when replaced or removed */
 		i_common->kolab_store = g_hash_table_new(g_direct_hash, g_direct_equal);
 	}
-	GList *list = g_hash_table_lookup(i_common->kolab_store, parent_ptr);
+	list = g_hash_table_lookup(i_common->kolab_store, parent_ptr);
 	if (reverse_order)
 		list = g_list_prepend(list, (gpointer)xml_str);
 	else
diff --git a/src/libekolabconv/main/src/util.c b/src/libekolabconv/main/src/util.c
index e947308..c8a2467 100644
--- a/src/libekolabconv/main/src/util.c
+++ b/src/libekolabconv/main/src/util.c
@@ -197,10 +197,10 @@ g_list_to_kolab_conv_mail (GList *glist)
 	kmail->length = g_list_length(glist);
 
 	if (kmail->length > 0) {
-		kmail->mail_parts = g_new0(Kolab_conv_mail_part, kmail->length);
+		int counter = 0;
 
+		kmail->mail_parts = g_new0(Kolab_conv_mail_part, kmail->length);
 
-		int counter = 0;
 		for (; glist; glist = glist->next, counter++) {
 			Kolab_conv_mail_part *mp = kmail->mail_parts+counter;
 			memcpy(mp, glist->data, sizeof (Kolab_conv_mail_part));
diff --git a/src/libekolabconv/test/src/email-parser.c b/src/libekolabconv/test/src/email-parser.c
index b8bb686..62ac0c6 100644
--- a/src/libekolabconv/test/src/email-parser.c
+++ b/src/libekolabconv/test/src/email-parser.c
@@ -66,9 +66,9 @@ write_email_to_disk (GMimeMessage *message, const char *folder_name)
 static void
 find_email_attachments (GMimeObject *parent, GMimeObject *part, gpointer user_data)
 {
+	g_mime_objects_data *data = user_data;
 	(void)parent;
 	
-	g_mime_objects_data *data = user_data;
 	/* if (( parent->content_type->content type is text/plain or text/html) and	(it's not an attachment)) */
 	data->g_mime_objects = g_list_append (data->g_mime_objects, (GMimeObject *) part);
 }
@@ -364,9 +364,10 @@ read_kolab_email_file(const gchar *filename, GError** error) {
 	iterator = g_mime_obj_data.g_mime_objects;
 
 	while (iterator != NULL) {
+		gchar *type = NULL;
 		/* Get the first GMimeObject */
 		g_mime_obj = ((GMimeObject *) iterator->data);
-		gchar *type = g_mime_obj->content_type->type;
+		type = g_mime_obj->content_type->type;
 		/* printf("\na %s, %s", gMimeObj->content_type->type, gMimeObj->content_type->subtype); */
 		if (  strcmp (type, "Multipart") != 0 && strcmp (type, "multipart") != 0 &&
 			(strcmp (type, "Text") != 0) && (strcmp (type, "text") != 0) ){
@@ -414,16 +415,18 @@ read_kolab_email_file(const gchar *filename, GError** error) {
 void
 write_kolab_email_file (const Kolab_conv_mail *mail, const gchar *filename, GError** error)
 {
-	g_mime_init (0);
-
-	GMimeMessage *message = g_mime_message_new (TRUE);
-
+	GMimeMessage *message = NULL;
+	GList *klb_mail_list = NULL;
+	
 	(void)error;
 
+	g_mime_init (0);
+
+	message = g_mime_message_new (TRUE);
 	construct_g_mime_message (message);
 
 	/* Add all attachments from the mail */
-	GList *klb_mail_list = klb_conv_mail_to_g_list(mail);
+	klb_mail_list = klb_conv_mail_to_g_list(mail);
 	add_klb_mail_list_to_g_mime_message (message, klb_mail_list);
 
 	/* write_message_to_screen (message); */
diff --git a/src/libekolabconv/test/src/main.c b/src/libekolabconv/test/src/main.c
index 8a067c2..247385d 100644
--- a/src/libekolabconv/test/src/main.c
+++ b/src/libekolabconv/test/src/main.c
@@ -39,6 +39,8 @@ read_config_file()
 {
 	GError *error = NULL;
 	GKeyFile *key_file = g_key_file_new();
+	gchar *log_file_name = NULL;
+	
 	if (!g_key_file_load_from_file (key_file, TEST_CONFIG_FILE_NAME, G_KEY_FILE_NONE, &error)) {
 		g_error ( "error reading config file %s:\n%s", TEST_CONFIG_FILE_NAME, error->message);
 		exit(-1);
@@ -54,7 +56,7 @@ read_config_file()
 	evolution_folder_I_event   = g_key_file_get_string(key_file, "main", "EvolutionEventFolder", NULL);
 	evolution_folder_I_task    = g_key_file_get_string(key_file, "main", "EvolutionTaskFolder", NULL);
 	evolution_folder_I_note    = g_key_file_get_string(key_file, "main", "EvolutionNoteFolder", NULL);
-	gchar *log_file_name = g_key_file_get_string(key_file, "main", "TestLogFile", NULL);
+	log_file_name = g_key_file_get_string(key_file, "main", "TestLogFile", NULL);
 
 	log_fp = fopen(log_file_name, "w");
 	g_free(log_file_name);
@@ -109,6 +111,8 @@ free_mem(gpointer mem_ptr, gpointer unused)
 int
 main (int argc, char *argv[])
 {
+	int success;
+	
 	/* read values from test configuration file */
 	read_config_file();
 
@@ -127,7 +131,7 @@ main (int argc, char *argv[])
 	add_all_tests_I_note();
 
 	/* run tests */
-	int success = g_test_run ();
+	success = g_test_run ();
 
 	g_list_foreach(free_mem_after_test, free_mem, NULL);
 	g_list_free(free_mem_after_test);
diff --git a/src/libekolabconv/test/src/test-evolution-event.c b/src/libekolabconv/test/src/test-evolution-event.c
index 4651b36..99a0232 100644
--- a/src/libekolabconv/test/src/test-evolution-event.c
+++ b/src/libekolabconv/test/src/test-evolution-event.c
@@ -255,6 +255,8 @@ validate_evolution_event_10(const I_event *ievent, gint stage)
 void
 validate_evolution_event_11(const I_event *ievent, gint stage)
 {
+	gint rdate[3] = {10,9,2010};
+
 	log_bitmask(stage);
 
 	g_assert(ievent != NULL);
@@ -265,7 +267,6 @@ validate_evolution_event_11(const I_event *ievent, gint stage)
 			NULL, NULL, ICOMMON_SENSITIVITY_PUBLIC,
 			NULL, "2010-08-25 15:11:22", stage);
 
-	gint rdate[3] = {10,9,2010};
 	validate_recurrence(ievent->incidence->recurrence,
 			I_REC_CYCLE_DAILY, 2, 0, rdate, 0, 0, 0);
 }
@@ -307,6 +308,8 @@ validate_evolution_event_13(const I_event *ievent, gint stage)
 void
 validate_evolution_event_14(const I_event *ievent, gint stage)
 {
+	gint rdate[3] = {27,9,2010};
+
 	log_bitmask(stage);
 
 	g_assert(ievent != NULL);
@@ -317,7 +320,6 @@ validate_evolution_event_14(const I_event *ievent, gint stage)
 			NULL, NULL, ICOMMON_SENSITIVITY_PUBLIC,
 			NULL, "2010-08-25 15:19:22", stage);
 
-	gint rdate[3] = {27,9,2010};
 	validate_recurrence(ievent->incidence->recurrence,
 			I_REC_CYCLE_WEEKLY, 2, 0, rdate, I_COMMON_MONDAY | I_COMMON_TUESDAY, 0, 0);
 }
@@ -391,6 +393,8 @@ validate_evolution_event_17(const I_event *ievent, gint stage)
 void
 validate_evolution_event_18(const I_event *ievent, gint stage)
 {
+	gint rdate[3] = {23,11,2010};
+
 	log_bitmask(stage);
 
 	/*
@@ -416,7 +420,6 @@ validate_evolution_event_18(const I_event *ievent, gint stage)
 			NULL, NULL, ICOMMON_SENSITIVITY_PUBLIC,
 			NULL, "2010-08-25 15:28:25", stage);
 
-	gint rdate[3] = {23,11,2010};
 	validate_recurrence(ievent->incidence->recurrence,
 			I_REC_CYCLE_MONTHLY_WEEKDAY, 1, 0, rdate, I_COMMON_WEDNESDAY, -1, 0);
 }
@@ -553,6 +556,8 @@ validate_evolution_event_22(const I_event *ievent, gint stage)
 void
 validate_evolution_event_23(const I_event *ievent, gint stage)
 {
+	gint rdate[3] = {31,8,2016};
+
 	log_bitmask(stage);
 
 	/*
@@ -578,7 +583,6 @@ validate_evolution_event_23(const I_event *ievent, gint stage)
 			NULL, NULL, ICOMMON_SENSITIVITY_PUBLIC,
 			NULL, "2010-08-25 15:36:55", stage);
 
-	gint rdate[3] = {31,8,2016};
 	validate_recurrence(ievent->incidence->recurrence,
 			I_REC_CYCLE_YEARLY_MONTHDAY, 2, 0, rdate, 0, 31, I_COMMON_AUG);
 }
@@ -1095,6 +1099,8 @@ validate_evolution_event_r1(const I_event *ievent, gint stage)
 void
 validate_evolution_event_b1(const I_event *ievent, gint stage)
 {
+	Alarm *mail_alarm = NULL;
+	
 	(void)stage;
 	
 	/* resulting alarm should look like this in kolab:
@@ -1116,7 +1122,7 @@ validate_evolution_event_b1(const I_event *ievent, gint stage)
 	/* advanced alarms */
 	g_assert_cmpint(g_list_length(ievent->incidence->advanced_alarm), ==, 1);
 	/* this is a mapped simple alarm from kolab */
-	Alarm *mail_alarm = assert_Alarm_in_list(ievent->incidence->advanced_alarm,
+	mail_alarm = assert_Alarm_in_list(ievent->incidence->advanced_alarm,
 						 I_ALARM_TYPE_EMAIL,
 						 -15,
 						 0,
diff --git a/src/libekolabconv/test/src/test-kolab-contact.c b/src/libekolabconv/test/src/test-kolab-contact.c
index bbf4a03..0c74bad 100644
--- a/src/libekolabconv/test/src/test-kolab-contact.c
+++ b/src/libekolabconv/test/src/test-kolab-contact.c
@@ -37,6 +37,8 @@
 void
 validate_kolab_contact_100 (const I_contact *icontact, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/*
@@ -159,7 +161,6 @@ validate_kolab_contact_100 (const I_contact *icontact, gint stage)
 	 * Kolab Store
 	 */
 	g_assert(icontact->common->kolab_store != NULL);
-	GList *list;
 	list = kolab_store_get_element_list(icontact->common, icontact->common);
 	g_assert_cmpint(g_list_length(list), ==, 13);
 	validate_kolab_store_xml(list, 0, "sensitivity");
@@ -198,6 +199,8 @@ validate_kolab_contact_100 (const I_contact *icontact, gint stage)
 void
 validate_kolab_contact_200 (const I_contact *icontact, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/*
@@ -318,7 +321,6 @@ validate_kolab_contact_200 (const I_contact *icontact, gint stage)
 	 */
 	g_assert(icontact->common->kolab_store != NULL);
 
-	GList *list;
 	list = kolab_store_get_element_list(icontact->common, icontact->common);
 	g_assert_cmpint(g_list_length(list), ==, IS_TEST_STAGE_EVO_TO_INTERN(stage) ? 18:11);	/* x-custom fields can not be set before conversion to evolution */
 	validate_kolab_store_xml(list, 0, "sensitivity");
@@ -374,6 +376,10 @@ validate_kolab_contact_201 (const I_contact *icontact, gint stage)
 void
 validate_kolab_contact_300 (const I_contact *icontact, gint stage)
 {
+	GList *list = NULL;
+	Phone_number* pn;
+	Email *eml;
+
 	log_bitmask(stage);
 
 	/*
@@ -469,7 +475,6 @@ validate_kolab_contact_300 (const I_contact *icontact, gint stage)
 	g_assert(icontact->common->kolab_store != NULL);
 	/* validate number of locations with unknown elements */
 	/* g_assert_cmpint(g_hash_table_size(icontact->common->kolab_store), ==, 2); */
-	GList *list;
 	/* get top level unknown elements */
 	 list = kolab_store_get_element_list(icontact->common, (gpointer) KOLAB_STORE_PTR_CONTACT_NAME);
 	 g_assert_cmpint(g_list_length(list), ==, 2);
@@ -494,7 +499,6 @@ validate_kolab_contact_300 (const I_contact *icontact, gint stage)
 	IS_TEST_STAGE_EVO_TO_INTERN(stage) ? validate_kolab_store_xml(list, 11, "x-custom") : NULL ;
 
 	/* test elements below phone number elements */
-	Phone_number* pn;
 
 	pn = assert_phone_in_list (icontact->phone_numbers, "110", ICONTACT_PHONE_HOME_1);
 	list = kolab_store_get_element_list(icontact->common, pn);
@@ -513,8 +517,6 @@ validate_kolab_contact_300 (const I_contact *icontact, gint stage)
 	validate_kolab_store_xml(list, 0, "unknown5");
 
 
-	Email *eml;
-
 	eml = assert_email_in_list(icontact->emails, "peter uni de", NULL);
 	list = kolab_store_get_element_list(icontact->common, eml);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -560,6 +562,8 @@ validate_kolab_contact_302 (const I_contact *icontact, gint stage)
 void
 validate_kolab_contact_500 (const I_contact *icontact, gint stage)
 {
+	GList *list = NULL;
+	
 	(void)stage;
 	
 	assert_email_in_list (icontact->emails, "a1 b d", NULL);
@@ -568,7 +572,7 @@ validate_kolab_contact_500 (const I_contact *icontact, gint stage)
 	assert_email_in_list (icontact->emails, "a4 b d", NULL);
 	g_assert_cmpint(g_list_length(icontact->emails), ==, 4);
 
-	GList *list = kolab_store_get_element_list(icontact->common, icontact->common);
+	list = kolab_store_get_element_list(icontact->common, icontact->common);
 	validate_kolab_store_xml(list, 0, "sensitivity");
 	validate_kolab_store_xml(list, 1, "email");
 	validate_kolab_store_xml(list, 2, "email");
diff --git a/src/libekolabconv/test/src/test-kolab-event.c b/src/libekolabconv/test/src/test-kolab-event.c
index 8258d3c..62cbb12 100644
--- a/src/libekolabconv/test/src/test-kolab-event.c
+++ b/src/libekolabconv/test/src/test-kolab-event.c
@@ -31,6 +31,8 @@
 void
 validate_kolab_event_100(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -59,7 +61,6 @@ validate_kolab_event_100(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -79,6 +80,8 @@ validate_kolab_event_100(const I_event *ievent, gint stage)
 void
 validate_kolab_event_101(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -132,7 +135,6 @@ validate_kolab_event_101(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 6);
@@ -147,6 +149,8 @@ validate_kolab_event_101(const I_event *ievent, gint stage)
 void
 validate_kolab_event_102(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -175,7 +179,6 @@ validate_kolab_event_102(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -186,6 +189,8 @@ validate_kolab_event_102(const I_event *ievent, gint stage)
 void
 validate_kolab_event_103(const I_event *ievent, gint stage)
 {
+	GList *list = NULL; 
+
 	log_bitmask(stage);
 
 	/* common */
@@ -214,7 +219,6 @@ validate_kolab_event_103(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -225,6 +229,8 @@ validate_kolab_event_103(const I_event *ievent, gint stage)
 void
 validate_kolab_event_104(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -253,7 +259,6 @@ validate_kolab_event_104(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -264,6 +269,8 @@ validate_kolab_event_104(const I_event *ievent, gint stage)
 void
 validate_kolab_event_105(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */ 
@@ -292,7 +299,6 @@ validate_kolab_event_105(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -303,6 +309,8 @@ validate_kolab_event_105(const I_event *ievent, gint stage)
 void
 validate_kolab_event_106(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -331,7 +339,6 @@ validate_kolab_event_106(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -342,6 +349,8 @@ validate_kolab_event_106(const I_event *ievent, gint stage)
 void
 validate_kolab_event_107(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -370,7 +379,6 @@ validate_kolab_event_107(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -381,6 +389,8 @@ validate_kolab_event_107(const I_event *ievent, gint stage)
 void
 validate_kolab_event_108(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -409,7 +419,6 @@ validate_kolab_event_108(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -420,6 +429,8 @@ validate_kolab_event_108(const I_event *ievent, gint stage)
 void
 validate_kolab_event_109(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -464,7 +475,6 @@ validate_kolab_event_109(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -475,6 +485,8 @@ validate_kolab_event_109(const I_event *ievent, gint stage)
 void
 validate_kolab_event_110(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -503,7 +515,6 @@ validate_kolab_event_110(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -514,6 +525,8 @@ validate_kolab_event_110(const I_event *ievent, gint stage)
 void
 validate_kolab_event_111(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -558,7 +571,6 @@ validate_kolab_event_111(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -569,6 +581,8 @@ validate_kolab_event_111(const I_event *ievent, gint stage)
 void
 validate_kolab_event_112(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -613,7 +627,6 @@ validate_kolab_event_112(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -624,6 +637,8 @@ validate_kolab_event_112(const I_event *ievent, gint stage)
 void
 validate_kolab_event_113(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -668,7 +683,6 @@ validate_kolab_event_113(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -679,6 +693,8 @@ validate_kolab_event_113(const I_event *ievent, gint stage)
 void
 validate_kolab_event_114(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -733,7 +749,6 @@ validate_kolab_event_114(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -744,6 +759,8 @@ validate_kolab_event_114(const I_event *ievent, gint stage)
 void
 validate_kolab_event_115(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -798,7 +815,6 @@ validate_kolab_event_115(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -809,6 +825,8 @@ validate_kolab_event_115(const I_event *ievent, gint stage)
 void
 validate_kolab_event_116(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -863,7 +881,6 @@ validate_kolab_event_116(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -874,6 +891,8 @@ validate_kolab_event_116(const I_event *ievent, gint stage)
 void
 validate_kolab_event_117(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -928,7 +947,6 @@ validate_kolab_event_117(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -939,6 +957,8 @@ validate_kolab_event_117(const I_event *ievent, gint stage)
 void
 validate_kolab_event_118(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -993,7 +1013,6 @@ validate_kolab_event_118(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -1004,6 +1023,8 @@ validate_kolab_event_118(const I_event *ievent, gint stage)
 void
 validate_kolab_event_119(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -1058,7 +1079,6 @@ validate_kolab_event_119(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -1069,6 +1089,8 @@ validate_kolab_event_119(const I_event *ievent, gint stage)
 void
 validate_kolab_event_120(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -1123,7 +1145,6 @@ validate_kolab_event_120(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -1134,6 +1155,8 @@ validate_kolab_event_120(const I_event *ievent, gint stage)
 void
 validate_kolab_event_121(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -1188,7 +1211,6 @@ validate_kolab_event_121(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -1199,6 +1221,8 @@ validate_kolab_event_121(const I_event *ievent, gint stage)
 void
 validate_kolab_event_122(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -1253,7 +1277,6 @@ validate_kolab_event_122(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -1264,6 +1287,8 @@ validate_kolab_event_122(const I_event *ievent, gint stage)
 void
 validate_kolab_event_123(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -1318,7 +1343,6 @@ validate_kolab_event_123(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -1329,6 +1353,8 @@ validate_kolab_event_123(const I_event *ievent, gint stage)
 void
 validate_kolab_event_124(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -1383,7 +1409,6 @@ validate_kolab_event_124(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -1394,6 +1419,8 @@ validate_kolab_event_124(const I_event *ievent, gint stage)
 void
 validate_kolab_event_125(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -1448,7 +1475,6 @@ validate_kolab_event_125(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -1459,6 +1485,8 @@ validate_kolab_event_125(const I_event *ievent, gint stage)
 void
 validate_kolab_event_126(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -1531,7 +1559,6 @@ validate_kolab_event_126(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -1542,6 +1569,8 @@ validate_kolab_event_126(const I_event *ievent, gint stage)
 void
 validate_kolab_event_127(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -1596,7 +1625,6 @@ validate_kolab_event_127(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -1607,6 +1635,8 @@ validate_kolab_event_127(const I_event *ievent, gint stage)
 void
 validate_kolab_event_128(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -1661,7 +1691,6 @@ validate_kolab_event_128(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -1672,6 +1701,8 @@ validate_kolab_event_128(const I_event *ievent, gint stage)
 void
 validate_kolab_event_129(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -1726,7 +1757,6 @@ validate_kolab_event_129(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -1737,6 +1767,8 @@ validate_kolab_event_129(const I_event *ievent, gint stage)
 void
 validate_kolab_event_130(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -1791,7 +1823,6 @@ validate_kolab_event_130(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -1802,6 +1833,8 @@ validate_kolab_event_130(const I_event *ievent, gint stage)
 void
 validate_kolab_event_131(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -1856,7 +1889,6 @@ validate_kolab_event_131(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -1867,6 +1899,8 @@ validate_kolab_event_131(const I_event *ievent, gint stage)
 void
 validate_kolab_event_132(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -1921,7 +1955,6 @@ validate_kolab_event_132(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -1932,6 +1965,8 @@ validate_kolab_event_132(const I_event *ievent, gint stage)
 void
 validate_kolab_event_133(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -1986,7 +2021,6 @@ validate_kolab_event_133(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -1997,6 +2031,8 @@ validate_kolab_event_133(const I_event *ievent, gint stage)
 void
 validate_kolab_event_134(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -2051,7 +2087,6 @@ validate_kolab_event_134(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -2062,6 +2097,8 @@ validate_kolab_event_134(const I_event *ievent, gint stage)
 void
 validate_kolab_event_135(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -2116,7 +2153,6 @@ validate_kolab_event_135(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -2127,6 +2163,9 @@ validate_kolab_event_135(const I_event *ievent, gint stage)
 void
 validate_kolab_event_136(const I_event *ievent, gint stage)
 {
+	gint rdate[3] = {25,10,2020};
+	GList *list = NULL;
+	
 	log_bitmask(stage);
 
 	/* common */
@@ -2166,7 +2205,6 @@ validate_kolab_event_136(const I_event *ievent, gint stage)
 						 NULL);
 
 	/* recurrence */
-	gint rdate[3] = {25,10,2020};
 	validate_recurrence(ievent->incidence->recurrence,
 						I_REC_CYCLE_WEEKLY,
 						1,
@@ -2182,7 +2220,6 @@ validate_kolab_event_136(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -2193,6 +2230,8 @@ validate_kolab_event_136(const I_event *ievent, gint stage)
 void
 validate_kolab_event_137(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -2237,7 +2276,6 @@ validate_kolab_event_137(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -2248,6 +2286,8 @@ validate_kolab_event_137(const I_event *ievent, gint stage)
 void
 validate_kolab_event_138(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -2302,7 +2342,6 @@ validate_kolab_event_138(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -2313,6 +2352,8 @@ validate_kolab_event_138(const I_event *ievent, gint stage)
 void
 validate_kolab_event_139(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -2367,7 +2408,6 @@ validate_kolab_event_139(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -2378,6 +2418,8 @@ validate_kolab_event_139(const I_event *ievent, gint stage)
 void
 validate_kolab_event_140(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -2432,7 +2474,6 @@ validate_kolab_event_140(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
@@ -2444,6 +2485,9 @@ validate_kolab_event_140(const I_event *ievent, gint stage)
 void
 validate_kolab_event_201(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+	gint llen;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -2481,10 +2525,9 @@ validate_kolab_event_201(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
-	gint llen = g_list_length(list);
+	llen = g_list_length(list);
 	g_assert_cmpint(llen, ==, 1);
 	validate_kolab_store_xml(list, 0, "pilot-sync-status");
 }
@@ -2492,6 +2535,8 @@ validate_kolab_event_201(const I_event *ievent, gint stage)
 void
 validate_kolab_event_202(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -2529,7 +2574,6 @@ validate_kolab_event_202(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -2539,6 +2583,8 @@ validate_kolab_event_202(const I_event *ievent, gint stage)
 void
 validate_kolab_event_203(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -2576,7 +2622,6 @@ validate_kolab_event_203(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -2586,6 +2631,8 @@ validate_kolab_event_203(const I_event *ievent, gint stage)
 void
 validate_kolab_event_204(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 	/* TODO: Incidence: not handled elements: <advanced-alarms><enabled> */
 
@@ -2644,7 +2691,6 @@ validate_kolab_event_204(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -2663,6 +2709,8 @@ validate_kolab_event_204(const I_event *ievent, gint stage)
 void
 validate_kolab_event_205(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -2748,7 +2796,6 @@ validate_kolab_event_205(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -2758,12 +2805,13 @@ validate_kolab_event_205(const I_event *ievent, gint stage)
 void
 validate_kolab_event_206(const I_event *ievent, gint stage)
 {
+	GList *list;
+
 	log_bitmask(stage);
 	/* same as 205 with additional kolab store unknown elements
 	 * only test kolab store here
 	 */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* get top level unknown elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 4);
@@ -2971,6 +3019,8 @@ validate_kolab_event_502(const I_event *ievent, gint stage)
 void
 validate_kolab_event_503(const I_event *ievent, gint stage)
 {
+	Alarm *mail_alarm = NULL;
+	
 	(void)stage;
 	
 	/* advanced alarms */
@@ -2991,7 +3041,7 @@ validate_kolab_event_503(const I_event *ievent, gint stage)
 						 NULL);
 
 	/* this is a mapped simple alarm from kolab */
-	Alarm *mail_alarm = assert_Alarm_in_list(ievent->incidence->advanced_alarm,
+	mail_alarm = assert_Alarm_in_list(ievent->incidence->advanced_alarm,
 						 I_ALARM_TYPE_EMAIL,
 						 -15,
 						 0,
@@ -3014,6 +3064,8 @@ validate_kolab_event_503(const I_event *ievent, gint stage)
 void
 validate_kolab_event_504(const I_event *ievent, gint stage)
 {
+	Alarm *mail_alarm = NULL;
+	
 	(void)stage;
 	
 	/* advanced alarms */
@@ -3034,7 +3086,7 @@ validate_kolab_event_504(const I_event *ievent, gint stage)
 			 NULL);
 
 	/* this is a mapped simple alarm from kolab */
-	Alarm *mail_alarm = assert_Alarm_in_list(ievent->incidence->advanced_alarm,
+	mail_alarm = assert_Alarm_in_list(ievent->incidence->advanced_alarm,
 			 I_ALARM_TYPE_DISPLAY,
 			 -99,
 			 0,
@@ -3085,6 +3137,8 @@ validate_kolab_event_505(const I_event *ievent, gint stage)
 void
 validate_kolab_event_506(const I_event *ievent, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -3123,7 +3177,6 @@ validate_kolab_event_506(const I_event *ievent, gint stage)
 
 	/* kolab store */
 	g_assert(ievent->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(ievent->incidence->common, ievent->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 0);
diff --git a/src/libekolabconv/test/src/test-kolab-note.c b/src/libekolabconv/test/src/test-kolab-note.c
index 4a456fd..b345f82 100644
--- a/src/libekolabconv/test/src/test-kolab-note.c
+++ b/src/libekolabconv/test/src/test-kolab-note.c
@@ -57,6 +57,8 @@ validate_kolab_note_100(const I_note *inote, gint stage)
 void
 validate_kolab_note_200(const I_note *inote, gint stage)
 {
+	GList *list = NULL;
+
 	g_assert(inote != NULL);
 	g_assert(inote->common != NULL);
 
@@ -69,7 +71,6 @@ validate_kolab_note_200(const I_note *inote, gint stage)
 
 	/* kolab store */
 	g_assert(inote->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(inote->common, inote->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
diff --git a/src/libekolabconv/test/src/test-kolab-task.c b/src/libekolabconv/test/src/test-kolab-task.c
index 4693dd1..ce26dc5 100644
--- a/src/libekolabconv/test/src/test-kolab-task.c
+++ b/src/libekolabconv/test/src/test-kolab-task.c
@@ -258,6 +258,8 @@ validate_kolab_task_105(const I_task *itask, gint stage)
 void
 validate_kolab_task_106(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -288,7 +290,6 @@ validate_kolab_task_106(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/*  unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -521,6 +522,8 @@ validate_kolab_task_112(const I_task *itask, gint stage)
 void
 validate_kolab_task_201(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -552,7 +555,6 @@ validate_kolab_task_201(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -563,6 +565,8 @@ validate_kolab_task_201(const I_task *itask, gint stage)
 void
 validate_kolab_task_202(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -594,7 +598,6 @@ validate_kolab_task_202(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -605,6 +608,8 @@ validate_kolab_task_202(const I_task *itask, gint stage)
 void
 validate_kolab_task_203(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -635,7 +640,6 @@ validate_kolab_task_203(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -646,6 +650,8 @@ validate_kolab_task_203(const I_task *itask, gint stage)
 void
 validate_kolab_task_204(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -676,7 +682,6 @@ validate_kolab_task_204(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -687,6 +692,8 @@ validate_kolab_task_204(const I_task *itask, gint stage)
 void
 validate_kolab_task_205(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -718,7 +725,6 @@ validate_kolab_task_205(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -729,6 +735,8 @@ validate_kolab_task_205(const I_task *itask, gint stage)
 void
 validate_kolab_task_206(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -760,7 +768,6 @@ validate_kolab_task_206(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -771,6 +778,8 @@ validate_kolab_task_206(const I_task *itask, gint stage)
 void
 validate_kolab_task_207(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -802,7 +811,6 @@ validate_kolab_task_207(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -815,6 +823,8 @@ validate_kolab_task_207(const I_task *itask, gint stage)
 void
 validate_kolab_task_208(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 	/* TODO: Incidence: not handled elements: <advanced-alarms><enabled> */
 
@@ -861,7 +871,6 @@ validate_kolab_task_208(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -896,6 +905,8 @@ validate_kolab_task_208(const I_task *itask, gint stage)
 void
 validate_kolab_task_209(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 	/* TODO: Incidence: not handled elements: <advanced-alarms><enabled> */
 
@@ -941,7 +952,6 @@ validate_kolab_task_209(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -952,6 +962,8 @@ validate_kolab_task_209(const I_task *itask, gint stage)
 void
 validate_kolab_task_210(const I_task *itask, gint stage)
 {
+	GList *list;
+
 	log_bitmask(stage);
 	/* TODO: Incidence: not handled elements: <advanced-alarms><enabled> */
 
@@ -997,7 +1009,6 @@ validate_kolab_task_210(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -1008,6 +1019,8 @@ validate_kolab_task_210(const I_task *itask, gint stage)
 void
 validate_kolab_task_211(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -1039,7 +1052,6 @@ validate_kolab_task_211(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -1050,6 +1062,8 @@ validate_kolab_task_211(const I_task *itask, gint stage)
 void
 validate_kolab_task_212(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -1081,7 +1095,6 @@ validate_kolab_task_212(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level element */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -1092,6 +1105,8 @@ validate_kolab_task_212(const I_task *itask, gint stage)
 void
 validate_kolab_task_213(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -1180,7 +1195,6 @@ validate_kolab_task_213(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -1191,6 +1205,8 @@ validate_kolab_task_213(const I_task *itask, gint stage)
 void
 validate_kolab_task_214(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -1235,7 +1251,6 @@ validate_kolab_task_214(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_debug("kolabstore list length: %i", g_list_length(list));
@@ -1247,6 +1262,8 @@ validate_kolab_task_214(const I_task *itask, gint stage)
 void
 validate_kolab_task_215(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -1293,7 +1310,6 @@ validate_kolab_task_215(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -1304,6 +1320,8 @@ validate_kolab_task_215(const I_task *itask, gint stage)
 void
 validate_kolab_task_216(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -1348,7 +1366,6 @@ validate_kolab_task_216(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -1359,6 +1376,8 @@ validate_kolab_task_216(const I_task *itask, gint stage)
 void
 validate_kolab_task_217(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -1403,7 +1422,6 @@ validate_kolab_task_217(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -1414,6 +1432,8 @@ validate_kolab_task_217(const I_task *itask, gint stage)
 void
 validate_kolab_task_218(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -1458,7 +1478,6 @@ validate_kolab_task_218(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -1469,6 +1488,8 @@ validate_kolab_task_218(const I_task *itask, gint stage)
 void
 validate_kolab_task_219(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -1513,7 +1534,6 @@ validate_kolab_task_219(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -1524,6 +1544,8 @@ validate_kolab_task_219(const I_task *itask, gint stage)
 void
 validate_kolab_task_220(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -1568,7 +1590,6 @@ validate_kolab_task_220(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -1579,6 +1600,8 @@ validate_kolab_task_220(const I_task *itask, gint stage)
 void
 validate_kolab_task_221(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -1623,7 +1646,6 @@ validate_kolab_task_221(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -1634,6 +1656,8 @@ validate_kolab_task_221(const I_task *itask, gint stage)
 void
 validate_kolab_task_222(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -1678,7 +1702,6 @@ validate_kolab_task_222(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -1689,6 +1712,8 @@ validate_kolab_task_222(const I_task *itask, gint stage)
 void
 validate_kolab_task_223(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -1733,7 +1758,6 @@ validate_kolab_task_223(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -1744,6 +1768,8 @@ validate_kolab_task_223(const I_task *itask, gint stage)
 void
 validate_kolab_task_224(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -1789,7 +1815,6 @@ validate_kolab_task_224(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -1800,6 +1825,8 @@ validate_kolab_task_224(const I_task *itask, gint stage)
 void
 validate_kolab_task_225(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+	
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -1848,7 +1875,7 @@ validate_kolab_task_225(const I_task *itask, gint stage)
 	g_assert(itask->incidence->common->kolab_store != NULL);
 
 	/* unknown top level elements */
-	GList *list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
+	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	assert_list_length(list, 2);
 	validate_kolab_store_xml(list, 0, "pilot-sync-status");
 	validate_kolab_store_xml(list, 1, "recurrence");
@@ -1858,6 +1885,8 @@ validate_kolab_task_225(const I_task *itask, gint stage)
 void
 validate_kolab_task_226(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+	
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -1906,7 +1935,7 @@ validate_kolab_task_226(const I_task *itask, gint stage)
 	g_assert(itask->incidence->common->kolab_store != NULL);
 
 	/* unknown top level elements */
-	GList *list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
+	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	assert_list_length(list, 2);
 	validate_kolab_store_xml(list, 0, "pilot-sync-status");
 	validate_kolab_store_xml(list, 1, "recurrence");
@@ -1916,6 +1945,8 @@ validate_kolab_task_226(const I_task *itask, gint stage)
 void
 validate_kolab_task_227(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -1960,7 +1991,6 @@ validate_kolab_task_227(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -1971,6 +2001,8 @@ validate_kolab_task_227(const I_task *itask, gint stage)
 void
 validate_kolab_task_228(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+	
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -2017,7 +2049,7 @@ validate_kolab_task_228(const I_task *itask, gint stage)
 	g_assert(itask->incidence->common->kolab_store != NULL);
 
 	/* unknown top level elements */
-	GList *list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
+	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	assert_list_length(list, 1);
 	validate_kolab_store_xml(list, 0, "pilot-sync-status");
 	/* validate_kolab_store_xml(list, 1, "recurrence"); */
@@ -2027,6 +2059,8 @@ validate_kolab_task_228(const I_task *itask, gint stage)
 void
 validate_kolab_task_229(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -2071,7 +2105,6 @@ validate_kolab_task_229(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -2082,6 +2115,8 @@ validate_kolab_task_229(const I_task *itask, gint stage)
 void
 validate_kolab_task_230(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -2126,7 +2161,6 @@ validate_kolab_task_230(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -2137,6 +2171,8 @@ validate_kolab_task_230(const I_task *itask, gint stage)
 void
 validate_kolab_task_231(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -2181,7 +2217,6 @@ validate_kolab_task_231(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -2192,6 +2227,9 @@ validate_kolab_task_231(const I_task *itask, gint stage)
 void
 validate_kolab_task_232(const I_task *itask, gint stage)
 {
+	gint rdate[3] = {24,8,2011};
+	GList *list = NULL;
+	
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -2218,7 +2256,6 @@ validate_kolab_task_232(const I_task *itask, gint stage)
 						stage);
 
 	/* recurrence */
-	gint rdate[3] = {24,8,2011};
 	validate_recurrence(itask->incidence->recurrence,
 						I_REC_CYCLE_WEEKLY,
 						1,
@@ -2237,7 +2274,6 @@ validate_kolab_task_232(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -2248,6 +2284,8 @@ validate_kolab_task_232(const I_task *itask, gint stage)
 void
 validate_kolab_task_233(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -2298,7 +2336,6 @@ validate_kolab_task_233(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 1);
@@ -2308,6 +2345,8 @@ validate_kolab_task_233(const I_task *itask, gint stage)
 void
 validate_kolab_task_234(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+	
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -2315,7 +2354,7 @@ validate_kolab_task_234(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
+	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	assert_list_length(list, 2);
 	validate_kolab_store_xml(list, 0, "pilot-sync-status");
 	validate_kolab_store_xml(list, 1, "parent");
@@ -2324,6 +2363,8 @@ validate_kolab_task_234(const I_task *itask, gint stage)
 void
 validate_kolab_task_235(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+	
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -2331,7 +2372,7 @@ validate_kolab_task_235(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
+	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	assert_list_length(list, 1);
 	validate_kolab_store_xml(list, 0, "pilot-sync-status");
 }
@@ -2339,6 +2380,8 @@ validate_kolab_task_235(const I_task *itask, gint stage)
 void
 validate_kolab_task_236(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	g_assert(itask != NULL);
 	g_assert(itask->incidence != NULL);
 
@@ -2384,7 +2427,6 @@ validate_kolab_task_236(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	assert_list_length(list, 2);
@@ -2418,6 +2460,8 @@ validate_kolab_task_502(const I_task *itask, gint stage)
 void
 validate_kolab_task_503(const I_task *itask, gint stage)
 {
+	GList *list = NULL;
+
 	log_bitmask(stage);
 
 	/* common */
@@ -2448,7 +2492,6 @@ validate_kolab_task_503(const I_task *itask, gint stage)
 
 	/* kolab store */
 	g_assert(itask->incidence->common->kolab_store != NULL);
-	GList *list;
 	/* unknown top level elements */
 	list = kolab_store_get_element_list(itask->incidence->common, itask->incidence->common);
 	g_assert_cmpint(g_list_length(list), ==, 2);
diff --git a/src/libekolabconv/test/src/test-util.c b/src/libekolabconv/test/src/test-util.c
index 1a55bab..73095d2 100644
--- a/src/libekolabconv/test/src/test-util.c
+++ b/src/libekolabconv/test/src/test-util.c
@@ -33,13 +33,15 @@
 void
 assert_equal(gchar *expected, GString *value)
 {
+	GString *expected_str = NULL;
+	
 	g_debug("testing if string value '%s' is equal to expected value '%s'", value ? value->str : NULL, expected);
 	if (expected == NULL) {
 		g_assert(value == NULL);
 		return;
 	}
 	g_assert(value != NULL);
-	GString *expected_str = g_string_new(expected);
+	expected_str = g_string_new(expected);
 	g_assert(g_string_equal(expected_str, value));
 	g_string_free(expected_str, TRUE);
 }
@@ -73,17 +75,20 @@ assert_equal_double (gdouble expected, gdouble value)
 void
 assert_equal_gdate(gchar *expected, GDate *gdate)
 {
+	gchar *gstr = NULL;
+	GString *gstr_new = NULL;
+	
 	if (expected == NULL) {
 		g_assert(gdate == NULL);
 		return;
 	}
 
-	gchar *gstr = g_strdup_printf("%04d-%02d-%02d",
+	gstr = g_strdup_printf("%04d-%02d-%02d",
 			g_date_get_year (gdate),
 			g_date_get_month (gdate),
 			g_date_get_day (gdate));
 
-	GString *gstr_new = g_string_new(gstr);
+	gstr_new = g_string_new(gstr);
 	assert_equal(expected, gstr_new);
 
 	g_free(gstr);
@@ -93,10 +98,14 @@ assert_equal_gdate(gchar *expected, GDate *gdate)
 void
 assert_equal_timestamp(gchar *expected, time_t *timestamp)
 {
+	struct tm *ts = NULL;
+	gchar *tstr = NULL;
+	
 	g_debug("timestamp: %lu", *timestamp);
-	struct tm *ts = gmtime(timestamp);
 
-	gchar *tstr = g_strdup_printf("%04d-%02d-%02d %02d:%02d:%02d",
+	ts = gmtime(timestamp);
+
+	tstr = g_strdup_printf("%04d-%02d-%02d %02d:%02d:%02d",
 			ts->tm_year + 1900,
 			ts->tm_mon + 1,
 			ts->tm_mday,
@@ -112,11 +121,13 @@ assert_equal_timestamp(gchar *expected, time_t *timestamp)
 }
 
 void
-assert_timestamp_not_older_than_10_seconds(time_t *timestamp) {
-
+assert_timestamp_not_older_than_10_seconds(time_t *timestamp)
+{
+	time_t now = NULL;
+	
 	g_debug("timestamp: %lu", *timestamp);
 
-	time_t now = time(NULL);
+	now = time(NULL);
 
 	g_assert(*timestamp <= now);
 
@@ -132,9 +143,9 @@ assert_phone_in_list (GList *phone_nrs, gchar *nr_expected, Icontact_phone_type
 {
 	gint found_type = 0; /* type found? */
 	gint matched_number = 0; /* numbers match? */
-
-	g_assert (phone_nrs != NULL);
 	Phone_number *ret = NULL;
+	
+	g_assert (phone_nrs != NULL);
 
 	while (phone_nrs != NULL) {
 		Phone_number *p = phone_nrs->data;
@@ -190,9 +201,10 @@ assert_list_length(GList *value, gint lenght_exp) {
 Email*
 assert_email_in_list (GList *emails, gchar *smtp_address_exp, gchar *display_name_exp)
 {
-	g_assert (emails != NULL);
 	Email *ret = NULL;
 
+	g_assert (emails != NULL);
+
 	while (emails != NULL) {
 		Email *e = emails->data;
 
@@ -337,6 +349,9 @@ assert_Alarm_in_list (GList *advancedAlarm, Alarm_type type, gint start_offset,
 	{
 		while (advancedAlarm != NULL) {
 				Alarm *alarm = advancedAlarm->data;
+				gint failed = 0; /* bitmap for error location */
+				char *bm = NULL;
+
 				g_assert (alarm != NULL);
 
 				g_debug ("advancedAlarm values: "
@@ -359,8 +374,6 @@ assert_Alarm_in_list (GList *advancedAlarm, Alarm_type type, gint start_offset,
 						alarm->email_param && alarm->email_param->subject ? alarm->email_param->subject->str : "NULL",
 						alarm->email_param && alarm->email_param->mail_text ? alarm->email_param->mail_text->str : "NULL");
 
-				gint failed = 0; /* bitmap for error location */
-
 				CHECK_FAILED(alarm->type == type, failed, 1);
 				CHECK_FAILED(alarm->start_offset == start_offset, failed, 2);
 				CHECK_FAILED(alarm->end_offset == end_offset, failed, 3);
@@ -375,7 +388,7 @@ assert_Alarm_in_list (GList *advancedAlarm, Alarm_type type, gint start_offset,
 				CHECK_FAILED(email_param_mail_text == NULL || strcmp(alarm->email_param->mail_text->str, email_param_mail_text) == 0, failed, 11);
 				/* email_param attachments list - own function assert_String_in_list() */
 
-				char *bm = int_to_bitmask(failed);
+				bm = int_to_bitmask(failed);
 				g_debug ("checks for alarm: %s", bm);
 				g_free(bm);
 
@@ -422,14 +435,15 @@ assert_GDate_in_list(GList *date_list, gchar *value)
 {
 	while (date_list != NULL)
 	{
+		gchar *gstr = NULL;
 		GDate *date_element = date_list->data;
 
 		g_assert (date_element != NULL);
 
-		gchar *gstr = g_strdup_printf("%04d-%02d-%02d",
-					  date_element->year,
-					  date_element->month,
-					  date_element->day);
+		gstr = g_strdup_printf("%04d-%02d-%02d",
+		                       date_element->year,
+		                       date_element->month,
+		                       date_element->day);
 
 		g_debug ("testing if date '%s' matches expected date '%s'", gstr, value);
 
@@ -612,6 +626,11 @@ validate_recurrence(const Recurrence *recurrence, Recurrence_cycle cycle,
 void
 assert_binary_attachment_equal(gchar *exp_data_file_name, gchar *name_exp, gchar *mime_type_exp, Kolab_conv_mail_part *value) {
 
+	FILE *file;
+	gchar *buffer;
+	gulong fileLen;
+	gint result;
+
 	g_assert(value != NULL);
 
 	g_assert_cmpstr(name_exp, ==, value->name);
@@ -619,10 +638,6 @@ assert_binary_attachment_equal(gchar *exp_data_file_name, gchar *name_exp, gchar
 
 	g_debug("testing if attached binary value is equal to content of file '%s'", exp_data_file_name);
 
-	FILE *file;
-	gchar *buffer;
-	gulong fileLen;
-
 	/* Open file */
 	file = fopen(exp_data_file_name, "rb");
 
@@ -651,15 +666,12 @@ assert_binary_attachment_equal(gchar *exp_data_file_name, gchar *name_exp, gchar
 	fread(buffer, fileLen, 1, file);
 	fclose(file);
 
-	gint result = memcmp(buffer, value->data, fileLen);
+	result = memcmp(buffer, value->data, fileLen);
 	g_free(buffer);
 
 	g_assert(result == 0);
 }
 
-
-
-
 void
 assert_binary_attachment_store_equal(gchar *exp_data_file_name, gchar *name_exp, gchar *mime_type_exp, I_common *icommon, gint idx) {
 	Kolab_conv_mail_part *value = g_list_nth_data(icommon->kolab_attachment_store, idx);
@@ -706,11 +718,14 @@ void
 validate_kolab_store_xml(GList *elements, gint index, gchar *name)
 {
 	GList *elem = g_list_nth(elements, index);
+	gchar *xml_str = NULL;
+	xmlDocPtr tree = NULL;
+	
 	g_assert(elem != NULL);
 
-	gchar *xml_str = (gchar*)elem->data;
+	xml_str = (gchar*)elem->data;
 	/* gchar *xml_str = (gchar*)g_list_nth(elements, index)->data; */
-	xmlDocPtr tree = xmlReadMemory (xml_str, strlen (xml_str), "test.xml", NULL, 0);
+	tree = xmlReadMemory (xml_str, strlen (xml_str), "test.xml", NULL, 0);
 	g_assert(tree->type == XML_DOCUMENT_NODE);
 	g_assert(tree->children != NULL);
 	g_assert(tree->children->type == XML_ELEMENT_NODE);
@@ -756,9 +771,9 @@ void
 validate_link_attachments(const I_common *icommon, ...)
 {
         va_list ap;
-        va_start(ap, icommon);
         gchar* v1, *v2;
         GList *lal = icommon->link_attachments;
+	va_start(ap, icommon);
         for (; lal != NULL; lal = lal->next) {
         	v1 = (gchar*) lal->data;
         	v2 = va_arg(ap, gchar*);
@@ -773,9 +788,9 @@ void
 validate_inline_attachment_names(const I_common *icommon, ...)
 {
         va_list ap;
-        va_start(ap, icommon);
         gchar* v1, *v2;
         GList *lal = icommon->inline_attachment_names;
+	va_start(ap, icommon);
         for (; lal != NULL; lal = lal->next) {
         	v1 = (gchar*) lal->data;
         	v2 = va_arg(ap, gchar*);
diff --git a/src/libekolabconv/test/src/testbase.c b/src/libekolabconv/test/src/testbase.c
index 04d8a8b..c990d72 100644
--- a/src/libekolabconv/test/src/testbase.c
+++ b/src/libekolabconv/test/src/testbase.c
@@ -79,9 +79,11 @@ static Kolab_conv_mail*
 read_kolab_email_file_tested (const gchar* filename, gint *stage)
 {
 	GError *error = NULL;
+	Kolab_conv_mail *mail = NULL;
+	
 	/* read kolab mail file to the kolab mail struct */
 	g_message("reading email file %s to a kolab mail struct", filename);
-	Kolab_conv_mail* mail = read_kolab_email_file (filename, &error);
+	mail = read_kolab_email_file (filename, &error);
 	check_error (error, "error while reading kolab email file %s", filename);
 	*stage |= TEST_STAGE_FILE_TO_KMAIL;
 	return mail;
@@ -101,10 +103,12 @@ write_kolab_email_file_tested (const gchar* filename, Kolab_conv_mail* mail, gin
 static gchar*
 create_evolution_vcard_tested_I_contact (const EContact* econtact, gint *stage)
 {
+	EVCardFormat version = EVC_FORMAT_VCARD_30;
+	gchar *vcard_str = NULL;
+
 	g_message("serializing evolution contact to vCard 3.0 string");
 
-	EVCardFormat version = EVC_FORMAT_VCARD_30;
-	gchar *vcard_str = e_vcard_to_string ((EVCard *) econtact, version);
+	vcard_str = e_vcard_to_string ((EVCard *) econtact, version);
 
 	*stage |= TEST_STAGE_EVO_TO_FILE;
 	return vcard_str;
@@ -113,19 +117,23 @@ create_evolution_vcard_tested_I_contact (const EContact* econtact, gint *stage)
 static gchar*
 create_evolution_vcard_tested (const ECalComponentWithTZ* epim, gint *stage)
 {
+	icalcomponent *ical_vevent = NULL;
+	icalcomponent *ical_vcal = NULL;
+	icalcomponent *ical_vtz = NULL;
+	gchar *ical_str = NULL;
+	
 	g_log ("libekolabconv", G_LOG_LEVEL_MESSAGE,
 			"serializing evolution event to vCard 3.0 string");
-	icalcomponent *ical_vevent = e_cal_component_get_icalcomponent (
+	ical_vevent = e_cal_component_get_icalcomponent (
 			(ECalComponent*) epim->maincomp);
-	icalcomponent *ical_vcal = icalcomponent_new_vcalendar ();
-	icalcomponent *ical_vtz = NULL;
+	ical_vcal = icalcomponent_new_vcalendar ();
 	if (epim->timezone != ((void *) 0)) {
 		ical_vtz = e_cal_component_get_icalcomponent (
 				(ECalComponent*) epim->timezone);
 		icalcomponent_add_component (ical_vcal, ical_vtz);
 	}
 	icalcomponent_add_component (ical_vcal, ical_vevent);
-	gchar *ical_str = icalcomponent_as_ical_string (ical_vcal);
+	ical_str = icalcomponent_as_ical_string (ical_vcal);
 	/* free allocated resources */
 	if (ical_vtz != NULL)
 		icalcomponent_remove_component(ical_vcal, ical_vtz);
@@ -157,8 +165,10 @@ create_evolution_vcard_tested_I_note (const ECalComponentWithTZ* enote, gint *st
 static EContact*
 process_evolution_vcard_tested_I_contact (const gchar* vcard_str, gint *stage)
 {
+	EContact *econtact = NULL;
+	
 	g_message("deserializing evolution contact from vCard 3.0 string");
-	EContact *econtact = e_contact_new_from_vcard(vcard_str);
+	econtact = e_contact_new_from_vcard(vcard_str);
 	*stage |= TEST_STAGE_FILE_TO_EVO;
 	return econtact;
 }
@@ -166,17 +176,25 @@ process_evolution_vcard_tested_I_contact (const gchar* vcard_str, gint *stage)
 static ECalComponentWithTZ*
 process_evolution_vcard_tested (const gchar* vcard_str, icalcomponent_kind kind, gint *stage)
 {
+	icalcomponent *ical_vcal = NULL;
+	icalcomponent *ical_vevent = NULL;
+	icalcomponent *ical_vtz = NULL;
+	ECalComponent *epim = NULL;
+	ECalComponent *etz = NULL;
+	ECalComponentWithTZ *ectz = NULL;
+	gboolean success = FALSE;
+	
 	g_message("deserializing evolution instance from vCard 3.0 string");
-	icalcomponent *ical_vcal = icalcomponent_new_from_string( vcard_str );
-	icalcomponent *ical_vevent = icalcomponent_get_first_component ( ical_vcal, kind );
-	ECalComponent *epim = e_cal_component_new();
-	gboolean success =  e_cal_component_set_icalcomponent (epim,  icalcomponent_new_clone ( ical_vevent ));
+	ical_vcal = icalcomponent_new_from_string( vcard_str );
+	ical_vevent = icalcomponent_get_first_component ( ical_vcal, kind );
+	epim = e_cal_component_new();
+	success = e_cal_component_set_icalcomponent (epim,  icalcomponent_new_clone ( ical_vevent ));
 	g_assert(success);
-	icalcomponent *ical_vtz = icalcomponent_get_first_component ( ical_vcal, ICAL_VTIMEZONE_COMPONENT );
-	ECalComponent *etz = e_cal_component_new();
+	ical_vtz = icalcomponent_get_first_component ( ical_vcal, ICAL_VTIMEZONE_COMPONENT );
+	etz = e_cal_component_new();
 	success =  e_cal_component_set_icalcomponent (etz,  icalcomponent_new_clone ( ical_vtz ));
 	g_assert(success);
-	ECalComponentWithTZ *ectz = g_new0(ECalComponentWithTZ, 1);
+	ectz = g_new0(ECalComponentWithTZ, 1);
 	ectz->maincomp = epim;
 	ectz->timezone = etz;
 	*stage |= TEST_STAGE_FILE_TO_EVO;
@@ -207,8 +225,9 @@ read_text_file_tested (const gchar* filename)
 {
 	GError *error = NULL;
 	gchar *contents = NULL;
+	gboolean success = FALSE;
 	g_message("reading file %s to memory", filename);
-	gboolean success = g_file_get_contents(filename, &contents, NULL, &error);
+	success = g_file_get_contents(filename, &contents, NULL, &error);
 	g_assert(success);
 	check_error (error, "error while processing kolab email struct");
 	return contents;
@@ -226,9 +245,10 @@ process_kolab_tested_##PIM_TYPE (const Kolab_conv_mail* kmail, void\
 (*testData) (const PIM_TYPE*, gint stage), gint *stage)\
 {\
 	GError *error = NULL;\
+	PIM_TYPE *ipim = NULL;\
 	/* convert kolab mail struct to a typed interchange struct */\
 	g_message("converting kolab mail struct to an interchange struct");\
-	PIM_TYPE *ipim = conv_kolab_conv_mail_to_##PIM_TYPE (kmail, &error);\
+	ipim = conv_kolab_conv_mail_to_##PIM_TYPE (kmail, &error);\
 	check_error (error, "error while processing kolab email struct");\
 	*stage |= TEST_STAGE_KMAIL_TO_INTERN;\
 	/* test interchange struct */\
@@ -272,9 +292,10 @@ process_evolution_tested_##PIM_TYPE (const EVO_TYPE* epim, void\
 (*testData) (const PIM_TYPE*, gint stage), gint *stage)\
 {\
 	GError *error = NULL;\
+	PIM_TYPE *ipim = NULL;\
 	/* convert to interchange struct again */\
 	g_message("converting evolution contact to interchange contact struct");\
-	PIM_TYPE *ipim = conv_##EVO_TYPE##_to_##PIM_TYPE (epim, &error);\
+	ipim = conv_##EVO_TYPE##_to_##PIM_TYPE (epim, &error);\
 	check_error (error, "error while processing evolution contact");\
 	*stage |= TEST_STAGE_EVO_TO_INTERN;\
 	\
@@ -295,14 +316,16 @@ create_evolution_tested_##PIM_TYPE (PIM_TYPE* ipim, void\
 (*testData) (const PIM_TYPE*, gint stage), gint *stage)\
 {\
 	GError *error = NULL;\
+	EVO_TYPE *epim = NULL;\
+	gint dummystage = 0;\
+	gchar *vcard = NULL;\
 	(void)testData;\
 	/* convert to interchange struct again */\
 	g_message("converting interchange contact struct to an evolution contact");\
-	EVO_TYPE *epim = conv_##PIM_TYPE##_to_##EVO_TYPE (&ipim, &error);\
+	epim = conv_##PIM_TYPE##_to_##EVO_TYPE (&ipim, &error);\
 	check_error (error, "error while creating evolution contact");\
 	g_assert(ipim == NULL);\
-	gint dummystage = 0;\
-	gchar *vcard = create_evolution_vcard_tested_##PIM_TYPE(epim, &dummystage);\
+	vcard = create_evolution_vcard_tested_##PIM_TYPE(epim, &dummystage);\
 	log_debug("%s", vcard);\
 	g_free(vcard);\
 	*stage |= TEST_STAGE_INTERN_TO_EVO;\
@@ -354,12 +377,14 @@ free_I_note (I_note **ipim)
 static void \
 test_convert_kolab_read_mailfile_read_kolab_##PIM_TYPE (const test_args_##PIM_TYPE *args)\
 {\
-	kolabconv_initialize ();\
 	gint stage = 0;\
+	Kolab_conv_mail *kmail = NULL;\
+	PIM_TYPE *ipim = NULL;\
+	kolabconv_initialize ();\
 	\
-	Kolab_conv_mail *kmail = read_kolab_email_file_tested (args->filename, &stage);\
+	kmail = read_kolab_email_file_tested (args->filename, &stage);\
 	log_xml_part(kmail);\
-	PIM_TYPE *ipim = process_kolab_tested_##PIM_TYPE(kmail, args->validate_op, &stage);\
+	ipim = process_kolab_tested_##PIM_TYPE(kmail, args->validate_op, &stage);\
 	free_##PIM_TYPE(&ipim);\
 	kolabconv_free_kmail(kmail);\
 	\
@@ -388,13 +413,16 @@ free_ECalComponentWithTZ(ECalComponentWithTZ *comp)
 static void \
 test_convert_evolution_read_vcard_read_evolution_##PIM_TYPE (const test_args_##PIM_TYPE *args)\
 {\
-	kolabconv_initialize ();\
 	gint stage = 0;\
-	gchar *vcard = read_text_file_tested(args->filename);\
+	gchar *vcard = NULL;\
+	EVO_TYPE *epim = NULL;\
+	PIM_TYPE *ipim = NULL;\
+	kolabconv_initialize ();\
+	vcard = read_text_file_tested(args->filename);\
 	g_debug("VCard:\n%s", vcard);\
-	EVO_TYPE *epim = process_evolution_vcard_tested_##PIM_TYPE(vcard, &stage);\
+	epim = process_evolution_vcard_tested_##PIM_TYPE(vcard, &stage);\
 	g_free(vcard);\
-	PIM_TYPE *ipim = process_evolution_tested_##PIM_TYPE (epim, args->validate_op, &stage);\
+	ipim = process_evolution_tested_##PIM_TYPE (epim, args->validate_op, &stage);\
 	free_##PIM_TYPE(&ipim);\
 	free_##EVO_TYPE(epim);\
 	/* TODO: log ipim (print_contact(ipim);*/\
@@ -410,15 +438,19 @@ test_convert_evolution_read_vcard_read_evolution(ECalComponentWithTZ, I_note)
 static void \
 test_convert_evolution_write_evolution_##PIM_TYPE (const test_args_##PIM_TYPE *args)\
 {\
-	kolabconv_initialize ();\
 	gint stage = 0;\
-	gchar *vcard = read_text_file_tested(args->filename);\
-	EVO_TYPE *epim = process_evolution_vcard_tested_##PIM_TYPE(vcard, &stage);\
+	gchar *vcard = NULL;\
+	EVO_TYPE *epim = NULL;\
+	EVO_TYPE *epim2 = NULL;\
+	PIM_TYPE *ipim = NULL;\
+	kolabconv_initialize ();\
+	vcard = read_text_file_tested(args->filename);\
+	epim = process_evolution_vcard_tested_##PIM_TYPE(vcard, &stage);\
 	g_free(vcard);\
-	PIM_TYPE *ipim = process_evolution_tested_##PIM_TYPE (epim, args->validate_op, &stage);\
+	ipim = process_evolution_tested_##PIM_TYPE (epim, args->validate_op, &stage);\
 	free_##EVO_TYPE(epim);\
 	g_message("preconditions ok");\
-	EVO_TYPE *epim2 = create_evolution_tested_##PIM_TYPE (ipim, args->validate_op, &stage);\
+	epim2 = create_evolution_tested_##PIM_TYPE (ipim, args->validate_op, &stage);\
 	vcard = create_evolution_vcard_tested_##PIM_TYPE(epim2, &stage);\
 	log_debug("%s", vcard);\
 	g_free(vcard);\
@@ -437,18 +469,23 @@ test_convert_evolution_write_evolution(ECalComponentWithTZ, I_note)
 static void \
 test_convert_evolution_write_vcard_##PIM_TYPE (const test_args_##PIM_TYPE *args)\
 {\
-	kolabconv_initialize ();\
 	gint stage = 0;\
-	gchar *vcard = read_text_file_tested(args->filename);\
-	EVO_TYPE *epim = process_evolution_vcard_tested_##PIM_TYPE(vcard, &stage);\
+	gchar *vcard = NULL;\
+	gchar *vcard_str = NULL;\
+	EVO_TYPE *epim = NULL;\
+	EVO_TYPE *epim2 = NULL;\
+	PIM_TYPE *ipim = NULL;\
+	kolabconv_initialize ();\
+	vcard = read_text_file_tested(args->filename);\
+	epim = process_evolution_vcard_tested_##PIM_TYPE(vcard, &stage);\
 	g_free(vcard);\
 	g_message("preconditions ok");\
-	gchar *vcard_str = create_evolution_vcard_tested_##PIM_TYPE(epim, &stage);\
+	vcard_str = create_evolution_vcard_tested_##PIM_TYPE(epim, &stage);\
 	free_##EVO_TYPE(epim);\
 	g_debug("VCard:\n%s", vcard_str);\
-	EVO_TYPE *epim2 = process_evolution_vcard_tested_##PIM_TYPE(vcard_str, &stage);\
+	epim2 = process_evolution_vcard_tested_##PIM_TYPE(vcard_str, &stage);\
 	g_free(vcard_str);\
-	PIM_TYPE *ipim = process_evolution_tested_##PIM_TYPE (epim2, args->validate_op, &stage);\
+	ipim = process_evolution_tested_##PIM_TYPE (epim2, args->validate_op, &stage);\
 	free_##PIM_TYPE(&ipim);\
 	free_##EVO_TYPE(epim2);\
 	kolabconv_shutdown ();\
@@ -463,15 +500,19 @@ test_convert_evolution_write_vcard(ECalComponentWithTZ, I_note)
 static void \
 test_convert_evolution_read_write_kolab_##PIM_TYPE (const test_args_##PIM_TYPE *args)\
 {\
-	kolabconv_initialize ();\
 	gint stage = 0;\
-	gchar *vcard = read_text_file_tested(args->filename);\
-	EVO_TYPE *epim = process_evolution_vcard_tested_##PIM_TYPE(vcard, &stage);\
+	gchar *vcard = NULL;\
+	EVO_TYPE *epim = NULL;\
+	PIM_TYPE *ipim = NULL;\
+	Kolab_conv_mail *kmail = NULL;\
+	kolabconv_initialize ();\
+	vcard = read_text_file_tested(args->filename);\
+	epim = process_evolution_vcard_tested_##PIM_TYPE(vcard, &stage);\
 	g_free(vcard);\
-	PIM_TYPE *ipim = process_evolution_tested_##PIM_TYPE (epim, args->validate_op, &stage);\
+	ipim = process_evolution_tested_##PIM_TYPE (epim, args->validate_op, &stage);\
 	free_##EVO_TYPE(epim);\
 	g_message("preconditions ok");\
-	Kolab_conv_mail *kmail = create_kolab_tested_##PIM_TYPE (ipim, args->validate_op, &stage);\
+	kmail = create_kolab_tested_##PIM_TYPE (ipim, args->validate_op, &stage);\
 	log_xml_part(kmail);\
 	ipim = process_kolab_tested_##PIM_TYPE (kmail, args->validate_op, &stage);\
 	free_##PIM_TYPE(&ipim);\
@@ -488,18 +529,23 @@ test_convert_evolution_read_write_kolab(ECalComponentWithTZ, I_note)
 static void \
 test_convert_evolution_read_write_mailfile_##PIM_TYPE (const test_args_##PIM_TYPE *args)\
 {\
-	kolabconv_initialize ();\
 	gint stage = 0;\
-	gchar *vcard = read_text_file_tested(args->filename);\
-	EVO_TYPE *epim = process_evolution_vcard_tested_##PIM_TYPE(vcard, &stage);\
+	gchar *vcard = NULL;\
+	EVO_TYPE *epim = NULL;\
+	PIM_TYPE *ipim = NULL;\
+	Kolab_conv_mail *kmail = NULL;\
+	Kolab_conv_mail *kmail2 = NULL;\
+	kolabconv_initialize ();\
+	vcard = read_text_file_tested(args->filename);\
+	epim = process_evolution_vcard_tested_##PIM_TYPE(vcard, &stage);\
 	g_free(vcard);\
-	PIM_TYPE *ipim = process_evolution_tested_##PIM_TYPE (epim, args->validate_op, &stage);\
+	ipim = process_evolution_tested_##PIM_TYPE (epim, args->validate_op, &stage);\
 	free_##EVO_TYPE(epim);\
-	Kolab_conv_mail *kmail = create_kolab_tested_##PIM_TYPE (ipim, args->validate_op, &stage);\
+	kmail = create_kolab_tested_##PIM_TYPE (ipim, args->validate_op, &stage);\
 	g_message("preconditions ok");\
 	write_kolab_email_file_tested (tempfile, kmail, &stage);\
 	kolabconv_free_kmail(kmail);\
-	Kolab_conv_mail *kmail2 = read_kolab_email_file_tested (tempfile, &stage);\
+	kmail2 = read_kolab_email_file_tested (tempfile, &stage);\
 	ipim = process_kolab_tested_##PIM_TYPE (kmail2, args->validate_op, &stage);\
 	free_##PIM_TYPE(&ipim);\
 	kolabconv_free_kmail(kmail2);\
@@ -515,14 +561,17 @@ test_convert_evolution_read_write_mailfile(ECalComponentWithTZ, I_note)
 static void \
 test_convert_kolab_write_mailfile_##PIM_TYPE (const test_args_##PIM_TYPE *args)\
 {\
-	kolabconv_initialize ();\
 	gint stage = 0;\
-	Kolab_conv_mail *kmail = read_kolab_email_file_tested (args->filename, &stage);\
+	Kolab_conv_mail *kmail = NULL;\
+	Kolab_conv_mail *kmail2 = NULL;\
+	PIM_TYPE *ipim = NULL;\
+	kolabconv_initialize ();\
+	kmail = read_kolab_email_file_tested (args->filename, &stage);\
 	g_message("preconditions ok");\
 	write_kolab_email_file_tested (tempfile, kmail, &stage);\
 	kolabconv_free_kmail(kmail);\
-	Kolab_conv_mail *kmail2 = read_kolab_email_file_tested (tempfile, &stage);\
-	PIM_TYPE *ipim = process_kolab_tested_##PIM_TYPE (kmail2, args->validate_op, &stage);\
+	kmail2 = read_kolab_email_file_tested (tempfile, &stage);\
+	ipim = process_kolab_tested_##PIM_TYPE (kmail2, args->validate_op, &stage);\
 	free_##PIM_TYPE(&ipim);\
 	kolabconv_free_kmail(kmail2);\
 	kolabconv_shutdown ();\
@@ -537,13 +586,16 @@ test_convert_kolab_write_mailfile(ECalComponentWithTZ, I_note)
 static void \
 test_convert_kolab_write_kolab_##PIM_TYPE (const test_args_##PIM_TYPE *args)\
 {\
-	kolabconv_initialize ();\
 	gint stage = 0;\
-	Kolab_conv_mail *kmail = read_kolab_email_file_tested (args->filename, &stage);\
-	PIM_TYPE *ipim = process_kolab_tested_##PIM_TYPE (kmail, args->validate_op, &stage);\
+	Kolab_conv_mail *kmail = NULL;\
+	Kolab_conv_mail *kmail2 = NULL;\
+	PIM_TYPE *ipim = NULL;\
+	kolabconv_initialize ();\
+	kmail = read_kolab_email_file_tested (args->filename, &stage);\
+	ipim = process_kolab_tested_##PIM_TYPE (kmail, args->validate_op, &stage);\
 	kolabconv_free_kmail(kmail);\
 	g_message("preconditions ok");\
-	Kolab_conv_mail *kmail2 = create_kolab_tested_##PIM_TYPE (ipim, args->validate_op, &stage);\
+	kmail2 = create_kolab_tested_##PIM_TYPE (ipim, args->validate_op, &stage);\
 	ipim = process_kolab_tested_##PIM_TYPE (kmail2, args->validate_op, &stage);\
 	free_##PIM_TYPE(&ipim);\
 	kolabconv_free_kmail(kmail2);\
@@ -559,13 +611,16 @@ test_convert_kolab_write_kolab(I_note)
 static void \
 test_convert_kolab_read_write_evolution_##PIM_TYPE (const test_args_##PIM_TYPE *args)\
 {\
-	kolabconv_initialize ();\
 	gint stage = 0;\
-	Kolab_conv_mail *kmail = read_kolab_email_file_tested (args->filename, &stage);\
-	PIM_TYPE *ipim = process_kolab_tested_##PIM_TYPE (kmail, args->validate_op, &stage);\
+	Kolab_conv_mail *kmail = NULL;\
+	PIM_TYPE *ipim = NULL;\
+	EVO_TYPE *epim = NULL;\
+	kolabconv_initialize ();\
+	kmail = read_kolab_email_file_tested (args->filename, &stage);\
+	ipim = process_kolab_tested_##PIM_TYPE (kmail, args->validate_op, &stage);\
 	kolabconv_free_kmail(kmail);\
 	g_message("preconditions ok");\
-	EVO_TYPE *epim = create_evolution_tested_##PIM_TYPE (ipim, args->validate_op, &stage);\
+	epim = create_evolution_tested_##PIM_TYPE (ipim, args->validate_op, &stage);\
 	ipim = process_evolution_tested_##PIM_TYPE (epim, args->validate_op, &stage);\
 	free_##PIM_TYPE(&ipim);\
 	free_##EVO_TYPE(epim);\
@@ -581,17 +636,22 @@ test_convert_kolab_read_write_evolution(ECalComponentWithTZ, I_note)
 static void \
 test_convert_kolab_read_write_vcard_##PIM_TYPE (test_args_##PIM_TYPE *args)\
 {\
-	kolabconv_initialize ();\
 	gint stage = 0;\
-	Kolab_conv_mail *kmail = read_kolab_email_file_tested (args->filename, &stage);\
-	PIM_TYPE *ipim = process_kolab_tested_##PIM_TYPE (kmail, args->validate_op, &stage);\
+	gchar *vcard_str = NULL;\
+	Kolab_conv_mail *kmail = NULL;\
+	PIM_TYPE *ipim = NULL;\
+	EVO_TYPE *econtact = NULL;\
+	EVO_TYPE *econtact2 = NULL;\
+	kolabconv_initialize ();\
+	kmail = read_kolab_email_file_tested (args->filename, &stage);\
+	ipim = process_kolab_tested_##PIM_TYPE (kmail, args->validate_op, &stage);\
 	kolabconv_free_kmail(kmail);\
-	EVO_TYPE *econtact = create_evolution_tested_##PIM_TYPE (ipim, args->validate_op, &stage);\
+	econtact = create_evolution_tested_##PIM_TYPE (ipim, args->validate_op, &stage);\
 	g_message("preconditions ok");\
-	gchar *vcard_str = create_evolution_vcard_tested_##PIM_TYPE(econtact, &stage);\
+	vcard_str = create_evolution_vcard_tested_##PIM_TYPE(econtact, &stage);\
 	free_##EVO_TYPE(econtact);\
 	g_debug("VCard:\n%s", vcard_str);\
-	EVO_TYPE *econtact2 = process_evolution_vcard_tested_##PIM_TYPE(vcard_str, &stage);\
+	econtact2 = process_evolution_vcard_tested_##PIM_TYPE(vcard_str, &stage);\
 	g_free(vcard_str);\
 	ipim = process_evolution_tested_##PIM_TYPE (econtact2, args->validate_op, &stage);\
 	free_##PIM_TYPE(&ipim);\
@@ -641,6 +701,7 @@ create_test_name(gchar *format, gchar *name)
 static void \
 add_tests_kolab_##PIM_TYPE (gchar *filename, void (*validate_op) (const PIM_TYPE*, int)) \
 {\
+	test_args_##PIM_TYPE *args = NULL;\
 	/* create the absolute filename of the contact with the given uid */\
 	gchar *kolab_file_rel = g_strdup_printf("%s%s",\
 			kolab_folder_##PIM_TYPE, filename);\
@@ -649,7 +710,7 @@ add_tests_kolab_##PIM_TYPE (gchar *filename, void (*validate_op) (const PIM_TYPE
 			working_dir, test_resource_folder, kolab_file_rel);\
 	\
 	/* put filename and validating operation in an argument struct to be passed to the test operations */\
-	test_args_##PIM_TYPE *args = g_new0(test_args_##PIM_TYPE, 1);\
+	args = g_new0(test_args_##PIM_TYPE, 1);\
 	args-> filename = kolab_file_name;\
 	args-> validate_op = validate_op;\
 	\
@@ -685,6 +746,7 @@ add_tests_kolab(I_note)
 static void \
 add_tests_evolution_##PIM_TYPE (gchar *filename, void (*validate_op) (const PIM_TYPE*, int))\
 {\
+	test_args_##PIM_TYPE *args = NULL;\
 	/* create the absolute filename of the contact with the given uid */\
 	gchar *kolab_file_rel = g_strdup_printf("%s%s",\
 			evolution_folder_##PIM_TYPE, filename);\
@@ -693,7 +755,7 @@ add_tests_evolution_##PIM_TYPE (gchar *filename, void (*validate_op) (const PIM_
 			working_dir, test_resource_folder, kolab_file_rel);\
 	\
 	/* put filename and validating operation in an argument struct to be passed to the test operations */\
-	test_args_##PIM_TYPE *args = g_new0(test_args_##PIM_TYPE, 1);\
+	args = g_new0(test_args_##PIM_TYPE, 1);\
 	args-> filename = kolab_file_name;\
 	args-> validate_op = validate_op;\
 	\



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]