[PATCH v2 3/8] ntdll/tests: Make the zero_bits parameter explicit in all tests

Huw Davies huw at codeweavers.com
Mon Jun 17 05:11:17 CDT 2019


On Mon, Jun 17, 2019 at 11:49:59AM +0200, Rémi Bernon wrote:
> On Mon, 2019-06-17 at 10:45 +0100, Huw Davies wrote:
> > On Fri, Jun 14, 2019 at 03:11:12PM +0200, Rémi Bernon wrote:
> > > Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
> > > ---
> > >  dlls/ntdll/tests/virtual.c | 75 +++++++++++++++++++++++++---------
> > > ----
> > >  1 file changed, 50 insertions(+), 25 deletions(-)
> > > 
> > > diff --git a/dlls/ntdll/tests/virtual.c
> > > b/dlls/ntdll/tests/virtual.c
> > > index 26d058185fd..2a71a561a90 100644
> > > --- a/dlls/ntdll/tests/virtual.c
> > > +++ b/dlls/ntdll/tests/virtual.c
> > > @@ -39,21 +39,24 @@ static void test_AllocateVirtualMemory(void)
> > >      /* simple allocation should success */
> > >      size = 0x1000;
> > >      addr1 = NULL;
> > > -    status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr1,
> > > 0, &size,
> > > +    zero_bits = 0;
> > > +    status = NtAllocateVirtualMemory(NtCurrentProcess(), &addr1,
> > > zero_bits, &size,
> > >                                       MEM_RESERVE | MEM_COMMIT,
> > > PAGE_EXECUTE_READWRITE);
> > 
> > Does this really make things better?  If you follow this logic
> > through you'll be
> > creating a variable for every parameter and initialising it before
> > each call.
> > 
> > Huw.
> 
> There was one tests where a value was passed to the function and then
> the address result was checked using the local variable. I just wanted
> to avoid this kind of typo.

Ah, I see.  In that case let's just use the variable for the cases
where we're actaully testing zero_bits behaviour (most likely when
it's non-zero).  Otherwise just pass 0 directly to the function.

Huw.



More information about the wine-devel mailing list