Re: [PATCH 9/9] Fix using address of array instead of size

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

 



On Mon, Jun 23, 2014 at 10:55:29AM +0300, Johan Hedberg wrote:
> 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;

Yes, correct.

Best regards 
Andrei Emeltchenko 
--
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