All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 1/5] Refactor the command parsing framework
Date: Thu, 25 Mar 2010 12:24:30 -0500	[thread overview]
Message-ID: <201003251224.31500.denkenz@gmail.com> (raw)
In-Reply-To: <1269524901-1745-2-git-send-email-zhenhua.zhang@intel.com>

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

Hi Zhenhua,

> ---
>  gatchat/gatserver.c |  182
>  +++++++++++++++++++++++++++++++++++--------------- gatchat/gatserver.h |  
>   7 ++-
>  2 files changed, 133 insertions(+), 56 deletions(-)
> 
> -	at_command_notify(server, buf, prefix, type);
> +	notify = at_node_new(server, buf, prefix, type);
> +	if (!notify)
> +		goto error;
> 
>  	/* Also consume the terminating null */
> -	return i + 1;
> +	server->read_pos += i + 1;
> +	server->notify_source = g_idle_add_full(G_PRIORITY_DEFAULT,
> +						at_command_notify,
> +						notify, g_free);
> +
> +	return;
> +
> +error:
> +	g_free(notify);
> +
> +	g_at_server_send_final(server, G_AT_SERVER_RESULT_ERROR);
>  }

Err, OK stop right there.  This is really way too complicated.  How about we 
simply set a flag before calling at_command_notify.  If after executing it 
send_final or send_ext_final response has been sent, then we continue 
processing, otherwise we restart when send_ext_final or send_final will be 
called again.  You really don't need to touch this function at all.

> +typedef void (*GAtServerNotifyCallback)(gpointer user_data);
> +

Get rid of this, not necessary.

>  typedef void (*GAtServerNotifyFunc)(GAtServerRequestType type,
> -					GAtResult *result, gpointer user_data);
> +					GAtResult *result,
> +					gpointer user_data,
> +					GAtServerNotifyCallback cb,
> +					gpointer cb_data);
> 

Keep the NotifyFunc the way it is, your changes are really not required.

Regards,
-Denis

  parent reply	other threads:[~2010-03-25 17:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-25 13:48 [PATCH 0/5] Prototype to handle asynchronized callback Zhenhua Zhang
2010-03-25 13:48 ` [PATCH 1/5] Refactor the command parsing framework Zhenhua Zhang
2010-03-25 13:48   ` [PATCH 2/5] Add server send final result code Zhenhua Zhang
2010-03-25 13:48     ` [PATCH 3/5] Add set server to offline mode during parse line Zhenhua Zhang
2010-03-25 13:48       ` [PATCH 4/5] Add register S3-S5 basic command callbacks Zhenhua Zhang
2010-03-25 13:48         ` [PATCH 5/5] Add register ATE and other " Zhenhua Zhang
2010-03-25 17:24   ` Denis Kenzior [this message]
2010-03-25 23:37     ` [PATCH 1/5] Refactor the command parsing framework Zhang, Zhenhua
2010-03-26  1:10       ` 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=201003251224.31500.denkenz@gmail.com \
    --to=denkenz@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.