From: Johan Hedberg <johan.hedberg@gmail.com>
To: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 9/9] Fix using address of array instead of size
Date: Mon, 23 Jun 2014 10:55:29 +0300 [thread overview]
Message-ID: <20140623075529.GA29804@t440s> (raw)
In-Reply-To: <1403186136-30041-9-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
On Thu, Jun 19, 2014, Andrei Emeltchenko wrote:
> ---
> src/device.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
I've pushed patches 1-8 (with fixes to 7 and 8 due to messed up
indentation). This one doesn't make much sense though:
> diff --git a/src/device.c b/src/device.c
> index a9b644b..2003c7f 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -595,7 +595,11 @@ static gboolean dev_property_get_name(const GDBusPropertyTable *property,
> struct btd_device *device = data;
> const char *empty = "", *ptr;
>
> - ptr = device->name ?: empty;
> + if (strlen(device->name) > 0)
> + ptr = device->name;
> + else
> + ptr = empty;
Why do you need the whole "empty" variable here? If strlen(device->name)
is 0 then you've got the exact same thing: a pointer to an empty string.
So to me it seems that this snippet should be changed to simply:
ptr = device->name;
Johan
next prev parent reply other threads:[~2014-06-23 7:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-19 13:55 [PATCH 1/9] android/ipc-tester: Fix possible double close Andrei Emeltchenko
2014-06-19 13:55 ` [PATCH 2/9] tools/mpris-player: Fix overflow before type widening Andrei Emeltchenko
2014-06-19 13:55 ` [PATCH 3/9] queue: Fix unreachable code Andrei Emeltchenko
2014-06-19 13:55 ` [PATCH 4/9] tools/csr: Fix wrong error check Andrei Emeltchenko
2014-06-19 13:55 ` [PATCH 5/9] monitor: Fix checking boolean return value Andrei Emeltchenko
2014-06-19 13:55 ` [PATCH 6/9] bnep: Fix redundant check Andrei Emeltchenko
2014-06-19 13:55 ` [PATCH 7/9] hcitool: Fix adding missing break Andrei Emeltchenko
2014-06-19 13:55 ` [PATCH 8/9] hciconfig: " Andrei Emeltchenko
2014-06-19 13:55 ` [PATCH 9/9] Fix using address of array instead of size Andrei Emeltchenko
2014-06-23 7:55 ` Johan Hedberg [this message]
2014-06-23 8:09 ` Andrei Emeltchenko
2014-06-23 11:19 ` [PATCH] " Andrei Emeltchenko
2014-06-23 11:38 ` Johan Hedberg
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=20140623075529.GA29804@t440s \
--to=johan.hedberg@gmail.com \
--cc=Andrei.Emeltchenko.news@gmail.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;
as well as URLs for NNTP newsgroup(s).