On Tue, Sep 04, 2018 at 05:32:51PM +0200, Andrea Bolognani wrote:
On Tue, 2018-09-04 at 16:09 +0200, Ján Tomko wrote:
> On Fri, Aug 31, 2018 at 04:03:10PM +0200, Andrea Bolognani wrote:
> > +static char*
> > +qemuBuildVirtioDevStr(const virDomainDeviceInfo *info,
> > + const char *baseName)
[...]
> > + virBufferAsprintf(&buf, "%s-%s", baseName, implName);
>
> buf is used exactly once in this function, could have been just
> virAsprintf.
>
> Or, even better, since all the calls are followed by adding the string
> to a buffer, just pass the buffer as the function argument.
I did it that way initially, but then I changed it to return
a char* to be consistent with other qemuBuild*DevStr(). I can
definitely change it back, but perhaps a different name would
be more appropriate at that point.
OTOH, many qemuBuild.*Str which only build a repetitive part of the
string have a virBuffer as the first argument.
If the DevStr inconsistency bothers you, maybe
'qemuBuildVirtioDeviceStr' or qemuBuildVirtioDeviceSuffix{,Str}?
Jano