[RFC obexd v1 0/2] D-Bus error from GError

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

 



From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx>

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

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux