Linux bluetooth development
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: <linux-bluetooth@vger.kernel.org>
Cc: Szymon Janc <szymon.janc@tieto.com>
Subject: [RFC 0/7] adapter and device bdaddr_t getters
Date: Thu, 4 Oct 2012 14:05:57 +0200	[thread overview]
Message-ID: <1349352364-5491-1-git-send-email-szymon.janc@tieto.com> (raw)

Hi,

I've noticed that in many places similar code was created to adapt to current
adapter/device_get_address API:

bdaddr_t addr;
adapter_get_address(adapter, &addr);
foo(&addr);

bdaddr is constant anyway and such code can be converted to more convenient
foo(adapter_get_address(adapter));

Thanks to this we reduce number of memcpy calls of data that is not going to
change. Also number of local variables is removed (in places where it reduced
number of consecutive get_address calls or due to code readibility local
pointers were left).

Since this leads to calls where return is passed directly as function parameter
adapter/device_get_address could also be renamed to shorter form e.g.
adapter/device_get_addr  (like device_get_addr_type is called now).
(this is not done in this patchset).

Comments are welcome.

Szymon Janc (7):
  adapter: Convert adapter_get_address into simple getter
  storage: Constify bdaddr_t pointers parameters
  adapter: Constify pointer returned by adapter_get_address
  device: Convert device_get_address into simple getter
  mgmt: Constify use of bdaddr_t pointer parameters
  adapter: Constify use of bdaddr_t pointer parameters
  device: Make device_get_address return const pointer

 attrib/client.c               |   42 +++++------
 audio/manager.c               |   50 +++++--------
 plugins/adaptername.c         |    4 +-
 plugins/dbusoob.c             |    8 +--
 plugins/neard.c               |   21 +++---
 plugins/service.c             |   57 +++++----------
 plugins/wiimote.c             |    7 +-
 profiles/alert/server.c       |    4 +-
 profiles/gatt/gas.c           |   34 +++++----
 profiles/health/hdp.c         |   18 +++--
 profiles/health/hdp_util.c    |   42 +++++------
 profiles/health/mcap.c        |    2 +-
 profiles/health/mcap_lib.h    |    2 +-
 profiles/input/device.c       |    8 +--
 profiles/input/manager.c      |   11 +--
 profiles/network/connection.c |    6 +-
 profiles/network/connection.h |    2 +-
 profiles/network/manager.c    |   13 ++--
 profiles/network/server.c     |    8 +--
 profiles/proximity/monitor.c  |   20 +++---
 profiles/sap/manager.c        |    5 +-
 profiles/sap/server.c         |    2 +-
 profiles/sap/server.h         |    2 +-
 src/adapter.c                 |   73 +++++++++----------
 src/adapter.h                 |   59 +++++++++-------
 src/attrib-server.c           |   18 ++---
 src/device.c                  |  157 ++++++++++++++++-------------------------
 src/device.h                  |    3 +-
 src/eir.c                     |    2 +-
 src/eir.h                     |    2 +-
 src/event.c                   |   27 +++----
 src/manager.c                 |    5 +-
 src/mgmt.c                    |   31 ++++----
 src/mgmt.h                    |   26 +++----
 src/profile.c                 |   47 ++++++------
 src/storage.c                 |   97 +++++++++++++------------
 src/storage.h                 |   95 ++++++++++++++-----------
 37 files changed, 451 insertions(+), 559 deletions(-)

-- 
1.7.9.5


             reply	other threads:[~2012-10-04 12:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-04 12:05 Szymon Janc [this message]
2012-10-04 12:05 ` [RFC 1/7] adapter: Convert adapter_get_address into simple getter Szymon Janc
2012-10-04 12:05 ` [RFC 2/7] storage: Constify bdaddr_t pointers parameters Szymon Janc
2012-10-04 12:06 ` [RFC 3/7] adapter: Constify pointer returned by adapter_get_address Szymon Janc
2012-10-04 12:06 ` [RFC 4/7] device: Convert device_get_address into simple getter Szymon Janc
2012-10-04 12:06 ` [RFC 5/7] mgmt: Constify use of bdaddr_t pointer parameters Szymon Janc
2012-10-04 12:06 ` [RFC 6/7] adapter: " Szymon Janc
2012-10-04 12:06 ` [RFC 7/7] device: Make device_get_address return const pointer Szymon Janc

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=1349352364-5491-1-git-send-email-szymon.janc@tieto.com \
    --to=szymon.janc@tieto.com \
    --cc=linux-bluetooth@vger.kernel.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