Re: [PATCH] virnetdevopenvswitch: Don't call strlen() twice on the same string

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

 



On Wed, 2016-01-27 at 11:00 +0100, Andrea Bolognani wrote:
> n Wed, 2016-01-27 at 10:49 +0100, Jiri Denemark wrote:
> > 
> > Or just
> >  
> >      if (**migrate)
> >          (*migrate)[strlen(*migrate) - 1] = '\0';
> >  
> > (or similar check for the first character in *migrate) since we only
> > need to check if it's empty or not :-)
> 
> Yeah, that would work just as nicely, and would even save us the
> call to strlen() altogether when the string is empty.
> 
> However, I'd argue that it makes the code a tiny bit more opaque
> rather than a tiny bit cleaner, so I'd still go with the version
> I posted if that's okay with you :)

Pushed as Jirka confirmed on IRC he's okay with that :)

Cheers.

-- 
Andrea Bolognani
Software Engineer - Virtualization Team

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]