On Mon, Sep 30, 2019 at 01:32:50PM +0200, Ján Tomko wrote: > On Mon, Sep 30, 2019 at 10:37:53AM +0200, Peter Krempa wrote: > > On Fri, Sep 27, 2019 at 18:17:27 +0100, Daniel Berrange wrote: > > > Convert the string duplication APIs to use the g_strdup family of APIs. > > > > > > Annoyingly our virVasprintf/virAsprintf functions return the character > > > count, even though 90% of our usage doesn't need it. To retain compat > > The actual percentage is way closer to 100%, the only function that > actually uses the return value of virAsprintf is virNWFilterSnoopLeaseFileWrite. Something inthe test suite uses one of these functions, because when I did have it returning 0, the test suite never printed any output at all :-) Given the huge number of calls I didn't want to check them all for bugs. > And the only other function needing adjustment is libxlDomainCleanup > where we check for > 0 instead of >= 0 like in other places. > > Also, making virAsprintf return 0/-1 will actually fix the return value > of virLogSetDefaultOutput to match its documentation. > > Jano > > > > with these semantics we have a call to strlen which costs CPU time. > > > > I'd rather refactor the handful of cases which care about the formatted > > length and drop the strlens. I'd certainly like to Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list