Re: [libvirt PATCH 4/4] vbox: use g_new0 instead of VIR_ALLOC

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

 



On Mon, Oct 05, 2020 at 01:14:51PM +0200, Ján Tomko wrote:
> On a Monday in 2020, Erik Skultety wrote:
> > On Mon, Oct 05, 2020 at 12:22:26AM +0200, Ján Tomko wrote:
> > > Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
> > > ---
> > ...
> > 
> > > 
> > >      for (i = 0; i < sharedFolders.count; i++) {
> > >          ISharedFolder *sharedFolder = sharedFolders.items[i];
> > > @@ -3798,10 +3789,8 @@ vboxDumpAudio(virDomainDefPtr def, vboxDriverPtr data G_GNUC_UNUSED,
> > >              PRUint32 audioController = AudioControllerType_AC97;
> > > 
> > >              def->nsounds = 1;
> > > -            if (VIR_ALLOC_N(def->sounds, def->nsounds) < 0)
> > > -                return;
> > > -            if (VIR_ALLOC(def->sounds[0]) < 0)
> > > -                return;
> > > +            def->sounds = g_new0(virDomainSoundDefPtr, def->nsounds);
> > 
> > just use 1 for the counter
> 
> I can do that.
> 
> > and drop the nsounds attribute initialization
> > completely.
> 
> def->nsounds needs to be set to 1, otherwise virDomainDefFormat would
> not even look at def->sounds.

Brainfart...yes, what I actually wanted to write originally was to set
def->nsounds to 1 after the allocation to follow some logical pattern, somehow
ended up writing down a different thought, doesn't matter, just use 1 in the
g_new0 allocator and move on :).

Erik




[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]

  Powered by Linux