On 11/21/2013 12:27 AM, [email protected] wrote:
>
> + test_cases[0].oldfd = oldfd;
> + test_cases[0].newfd = oldfd;
> +
> + test_cases[1].oldfd = oldfd;
> This part is not vell designed. The thing is that code should follow
> principle of least surprise and if I read the code from the top to the
> bottom I was in an impression that the file descriptors are set to -1
> all the times.
>
> One solution is to use a pointer to a variable that is actually
> initialized in the setup, such as:
>
> static int test_fd;
>
> struct test {
> ...
> } testcases[] = {
> {&test_fd, &test_fd, ...},
> {&test_fd, -1, ...},
> };
>
> ...
Got it, thanks.
Xiaoguang Wang
>> +}
>> +
>> +static void cleanup(void)
>> +{
>> + TEST_CLEANUP;
>> +
>> + tst_rmdir();
>> +}
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing
conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list