linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC obexd v1 0/2] D-Bus error from GError
@ 2012-05-03 12:41 Mikel Astiz
  2012-05-03 12:41 ` [RFC obexd v1 1/2] gdbus: Add helper function for error-handling Mikel Astiz
  2012-05-03 12:41 ` [RFC obexd v1 2/2] client: Use new D-Bus helper function Mikel Astiz
  0 siblings, 2 replies; 3+ messages in thread
From: Mikel Astiz @ 2012-05-03 12:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Mikel Astiz

From: Mikel Astiz <mikel.astiz@bmw-carit.de>

As discussed in the IRC, leaving the semantics as proposed in the first version can be convenient, and thus haven't been changed here.

However the function needs to be NULL-proof, so an additional check has been added in patch 1/2. If given pointer is NULL or points to NULL, the function will return NULL. This can be useful to make the error-check after the call to the function.

>From original cover letter:

It is common that a D-Bus error message must be create from a GError object. Often this also involves freeing the GError's memory, which leads to boilerplate code. This RFC proposes a helper function in gdbus in order to remove this code.

The proposed name is g_dbus_steal_from_gerror(), which creates a DBusMessage out of a GError object, automatically frees the memory, and sets the pointer to NULL.

This removes 75 error-handling lines from the obex-client codebase, as included in patch 2/2. There are some other occurrences in the server side and also in BlueZ, but these have not been included here.

As returning GError objects starts to be more common in internal APIs (as planned for obex-client), this helper function would be even more convenient.

Mikel Astiz (2):
  gdbus: Add helper function for error-handling
  client: Use new D-Bus helper function

 client/ftp.c     |   85 +++++++++++++++--------------------------------------
 client/manager.c |   12 ++-----
 client/map.c     |   31 ++++++--------------
 client/pbap.c    |   29 +++++-------------
 client/sync.c    |   20 ++++---------
 gdbus/gdbus.h    |    4 ++
 gdbus/object.c   |   14 +++++++++
 7 files changed, 69 insertions(+), 126 deletions(-)

-- 
1.7.7.6


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-03 12:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-03 12:41 [RFC obexd v1 0/2] D-Bus error from GError Mikel Astiz
2012-05-03 12:41 ` [RFC obexd v1 1/2] gdbus: Add helper function for error-handling Mikel Astiz
2012-05-03 12:41 ` [RFC obexd v1 2/2] client: Use new D-Bus helper function Mikel Astiz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).