Re: [PATCH 3/8] tests: Move data directories into testQemuData

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

 



On Wed, 2019-03-13 at 10:22 +0100, Peter Krempa wrote:
> On Wed, Mar 13, 2019 at 10:18:52 +0100, Andrea Bolognani wrote:
> > Anyway, by the end of the series we'll have to pass dataDir to
> > testQemuCapsIterate() in addition to using it to build the path for
> > both the input and output file, so it makes sense to store it into
> > a variable instead of building it from abs_srcdir plus the directory
> > name two or more times.
> > 
> > As for why it's stored in the structure, I could easily have used a
> > global variable instead, but this approach seemed cleaner, especially
> > considering that we're already using the structure to store data that
> > is similar in scope (the driver).
> 
> Well, I agree that we should pre-construct the string rather than
> constructing it multiple times, but since every use of that string is
> inside the function which does the testing there's no point passing it
> in via the structure.

As mentioned above, one of the uses is as an argument to
testQemuCapsIterate(), which needs to be called from main() rather
than from doCapsTest().

So the alternatives are building the string multiple times, using a
global variable or doing what this patch does.

-- 
Andrea Bolognani / Red Hat / Virtualization

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

  Powered by Linux