Linux bluetooth development
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: Inga Stotland <ingas@codeaurora.org>
Cc: linux-bluetooth@vger.kernel.org, rshaffer@codeaurora.org,
	marcel@holtmann.org
Subject: Re: [PATCH 7/7] Add service UUIDs from EIR to device properties in "Device Found" signal.
Date: Wed, 4 Aug 2010 22:11:34 +0300	[thread overview]
Message-ID: <20100804191134.GA18869@jh-x301> (raw)
In-Reply-To: <1280941655-14313-8-git-send-email-ingas@codeaurora.org>

Hi Inga,

On Wed, Aug 04, 2010, Inga Stotland wrote:
> ---
>  src/adapter.c  |  106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
>  src/adapter.h  |    4 +-
>  src/dbus-hci.c |    6 ++--
>  3 files changed, 108 insertions(+), 8 deletions(-)

A few more things here:

> +static char **get_eir_uuids(uint8_t *eir_data, size_t *uuid_count)
> +{
> +	uint8_t len = 0;
> +	char **uuid_buf = NULL;
> +	char **uuids;
<snip>
> +	uuid_buf = g_new0(char *, total + 1);
> +
> +	if (!uuid_buf)
> +		return NULL;
> +
> +	uuids = uuid_buf;

First of all, g_new0 is guaranteed to return non-NULL. If something goes
wrong with the memory allocation abort() will be called and the process
will exit. So the NULL check is redundant. Secondly, I don't think you
need both of these variables (see further below).

> +	for (i = 0; i < uuid16_count; i++) {
> +		uint16_t val16 = uuid16[1];
> +
> +		val16 = (val16<<8) + uuid16[0];

Space missing before and after <<

> +		service.value.uuid16 = val16;
> +		*uuids++ = bt_uuid2string(&service);

Instead of incrementing the pointer you could just do

	uuids[i] = bt_uuid2string(&service);

That way the original pointer stays unchanged and you don't need the
second one.

Johan

  reply	other threads:[~2010-08-04 19:11 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-04 17:07 [PATCH v7 0/7] Enhanced support for extended inquiry response Inga Stotland
2010-08-04 17:07 ` [PATCH 1/7] Spec constants for Extended Inquiry Response field types Inga Stotland
2010-08-04 17:07 ` [PATCH 2/7] Minor fix when skipping duplicate UUID16 from EIR Inga Stotland
2010-08-04 17:07 ` [PATCH 3/7] Clean up code that generates extended inquiry response Inga Stotland
2010-08-04 17:07 ` [PATCH 4/7] Support for adding UUID128 to " Inga Stotland
2010-08-04 17:07 ` Inga Stotland
2010-08-04 17:07 ` [PATCH 6/7] Handle arrays in device properties dictionary Inga Stotland
2010-08-04 17:07 ` [PATCH 7/7] Add service UUIDs from EIR to device properties in "Device Found" signal Inga Stotland
2010-08-04 19:11   ` Johan Hedberg [this message]
2010-08-04 19:04 ` [PATCH v7 0/7] Enhanced support for extended inquiry response Johan Hedberg
2010-08-04 20:59   ` ingas
  -- strict thread matches above, loose matches on Subject: below --
2010-08-04 23:00 [PATCH v8 " Inga Stotland
2010-08-04 23:00 ` [PATCH 7/7] Add service UUIDs from EIR to device properties in "Device Found" signal Inga Stotland
2010-08-05 10:25   ` Johan Hedberg
2010-08-05 21:26     ` ingas
2010-08-05 22:36     ` Inga Stotland
2010-08-06  7:55       ` Johan Hedberg
2010-08-06  7:58         ` Johan Hedberg
2010-08-06 16:16         ` ingas
2010-08-06 17:30           ` Johan Hedberg
2010-08-06 18:18             ` ingas
2010-08-06 18:35             ` Inga Stotland
2010-08-07  3:10               ` Johan Hedberg
2010-08-04  0:03 [PATCH v6 0/7] Enhanced support for extended inquiry response Inga Stotland
2010-08-04  0:03 ` [PATCH 7/7] Add service UUIDs from EIR to device properties in "Device Found" signal Inga Stotland

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=20100804191134.GA18869@jh-x301 \
    --to=johan.hedberg@gmail.com \
    --cc=ingas@codeaurora.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=rshaffer@codeaurora.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