Open Source Telephony
 help / color / mirror / Atom feed
From: Yang Gu <gyagp0@gmail.com>
To: ofono@ofono.org
Subject: [PATCH 8/8] Move destructor prior to return
Date: Wed, 26 May 2010 22:39:14 +0800	[thread overview]
Message-ID: <1274884754-12977-8-git-send-email-yang.gu@intel.com> (raw)
In-Reply-To: <1274884754-12977-1-git-send-email-yang.gu@intel.com>

[-- Attachment #1: Type: text/plain, Size: 4766 bytes --]

---
 src/stkutil.c |   60 +++++++++++++++++++++++++-------------------------------
 1 files changed, 27 insertions(+), 33 deletions(-)

diff --git a/src/stkutil.c b/src/stkutil.c
index 3adb9e3..1a0c678 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -2116,11 +2116,11 @@ static gboolean parse_display_text(struct stk_command *command,
 				&obj->frame_id,
 				STK_DATA_OBJECT_TYPE_INVALID);
 
+	command->destructor = destroy_display_text;
+
 	if (ret == FALSE)
 		return FALSE;
 
-	command->destructor = destroy_display_text;
-
 	return TRUE;
 }
 
@@ -2154,11 +2154,11 @@ static gboolean parse_get_inkey(struct stk_command *command,
 				&obj->frame_id,
 				STK_DATA_OBJECT_TYPE_INVALID);
 
+	command->destructor = destroy_get_inkey;
+
 	if (ret == FALSE)
 		return FALSE;
 
-	command->destructor = destroy_get_inkey;
-
 	return TRUE;
 }
 
@@ -2196,11 +2196,11 @@ static gboolean parse_get_input(struct stk_command *command,
 				&obj->frame_id,
 				STK_DATA_OBJECT_TYPE_INVALID);
 
+	command->destructor = destroy_get_input;
+
 	if (ret == FALSE)
 		return FALSE;
 
-	command->destructor = destroy_get_input;
-
 	return TRUE;
 }
 
@@ -2247,11 +2247,11 @@ static gboolean parse_play_tone(struct stk_command *command,
 				&obj->frame_id,
 				STK_DATA_OBJECT_TYPE_INVALID);
 
+	command->destructor = destroy_play_tone;
+
 	if (ret == FALSE)
 		return FALSE;
 
-	command->destructor = destroy_play_tone;
-
 	return TRUE;
 }
 
@@ -2275,8 +2275,6 @@ static gboolean parse_poll_interval(struct stk_command *command,
 	if (ret == FALSE)
 		return FALSE;
 
-	command->destructor = NULL;
-
 	return TRUE;
 }
 
@@ -2330,10 +2328,12 @@ static gboolean parse_setup_menu(struct stk_command *command,
 	gboolean ret;
 
 	if (command->src != STK_DEVICE_IDENTITY_TYPE_UICC)
-		goto error;
+		return FALSE;
 
 	if (command->dst != STK_DEVICE_IDENTITY_TYPE_TERMINAL)
-		goto error;
+		return FALSE;
+
+	command->destructor = destroy_setup_menu;
 
 	ret = parse_dataobj(iter,
 			STK_DATA_OBJECT_TYPE_ALPHA_ID,
@@ -2342,12 +2342,12 @@ static gboolean parse_setup_menu(struct stk_command *command,
 			STK_DATA_OBJECT_TYPE_INVALID);
 
 	if (ret == FALSE)
-		goto error;
+		return FALSE;
 
 	obj->items = parse_item_list(iter);
 
 	if (obj->items == NULL)
-		goto error;
+		return FALSE;
 
 	ret = parse_dataobj(iter,
 			STK_DATA_OBJECT_TYPE_ITEMS_NEXT_ACTION_INDICATOR, 0,
@@ -2363,15 +2363,9 @@ static gboolean parse_setup_menu(struct stk_command *command,
 			STK_DATA_OBJECT_TYPE_INVALID);
 
 	if (ret == FALSE)
-		goto error;
-
-	command->destructor = destroy_setup_menu;
+		return FALSE;
 
 	return TRUE;
-
-error:
-	destroy_setup_menu(command);
-	return FALSE;
 }
 
 static void destroy_select_item(struct stk_command *command)
@@ -2566,11 +2560,11 @@ static gboolean parse_setup_call(struct stk_command *command,
 				&obj->frame_id,
 				STK_DATA_OBJECT_TYPE_INVALID);
 
+	command->destructor = destroy_setup_call;
+
 	if (ret == FALSE)
 		return FALSE;
 
-	command->destructor = destroy_setup_call;
-
 	return TRUE;
 }
 
@@ -2607,11 +2601,11 @@ static gboolean parse_refresh(struct stk_command *command,
 				&obj->frame_id,
 				STK_DATA_OBJECT_TYPE_INVALID);
 
+	command->destructor = destroy_refresh;
+
 	if (ret == FALSE)
 		return FALSE;
 
-	command->destructor = destroy_refresh;
-
 	return TRUE;
 }
 
@@ -2790,11 +2784,11 @@ static gboolean parse_setup_idle_mode_text(struct stk_command *command,
 				&obj->frame_id,
 				STK_DATA_OBJECT_TYPE_INVALID);
 
+	command->destructor = destroy_setup_idle_mode_text;
+
 	if (ret == FALSE)
 		return FALSE;
 
-	command->destructor = destroy_setup_idle_mode_text;
-
 	return TRUE;
 }
 
@@ -2829,11 +2823,11 @@ static gboolean parse_run_at_command(struct stk_command *command,
 				&obj->frame_id,
 				STK_DATA_OBJECT_TYPE_INVALID);
 
+	command->destructor = destroy_run_at_command;
+
 	if (ret == FALSE)
 		return FALSE;
 
-	command->destructor = destroy_run_at_command;
-
 	return TRUE;
 }
 
@@ -2868,11 +2862,11 @@ static gboolean parse_send_dtmf(struct stk_command *command,
 				&obj->frame_id,
 				STK_DATA_OBJECT_TYPE_INVALID);
 
+	command->destructor = destroy_send_dtmf;
+
 	if (ret == FALSE)
 		return FALSE;
 
-	command->destructor = destroy_send_dtmf;
-
 	return TRUE;
 }
 
@@ -2987,11 +2981,11 @@ static gboolean parse_launch_browser(struct stk_command *command,
 			&obj->text_passwd,
 			STK_DATA_OBJECT_TYPE_INVALID);
 
+	command->destructor = destroy_launch_browser;
+
 	if (ret == FALSE)
 		return FALSE;
 
-	command->destructor = destroy_launch_browser;
-
 	return TRUE;
 
 error:
-- 
1.7.0.4


  parent reply	other threads:[~2010-05-26 14:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-26 14:39 [PATCH 1/8] stk: Make parse_dataobj not consume extra data Yang Gu
2010-05-26 14:39 ` [PATCH 2/8] stk: Add parser for launch browser commands Yang Gu
2010-05-26 14:39 ` [PATCH 3/8] teststk: Add check of len in byte array Yang Gu
2010-05-26 14:39 ` [PATCH 4/8] teststk: Use check_common_text() to check string Yang Gu
2010-05-26 14:39 ` [PATCH 5/8] stk: Fix the parser of send sms Yang Gu
2010-05-26 14:39 ` [PATCH 6/8] teststk: Add cases for send sms parser Yang Gu
2010-05-26 14:39 ` [PATCH 7/8] teststk: Add test for launch browser parser Yang Gu
2010-05-26 14:39 ` Yang Gu [this message]
2010-05-27 17:48 ` [PATCH 1/8] stk: Make parse_dataobj not consume extra data Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1274884754-12977-8-git-send-email-yang.gu@intel.com \
    --to=gyagp0@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox