<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Cyril Hrubis <<a href="mailto:chrubis@suse.cz">chrubis@suse.cz</a>> wrote:<br></div></div><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> diff --git a/lib/tst_test.c b/lib/tst_test.c<br>
> index 9e745c537..fe2e2bb6c 100644<br>
> --- a/lib/tst_test.c<br>
> +++ b/lib/tst_test.c<br>
> @@ -1105,11 +1105,12 @@ static void do_setup(int argc, char *argv[])<br>
>               tst_tmpdir();<br>
>  <br>
>       if (tst_test->save_restore) {<br>
> -             const char * const *name = tst_test->save_restore;<br>
> +             const struct tst_path_val const *pvl = tst_test->save_restore;<br>
>  <br>
> -             while (*name) {<br>
> -                     tst_sys_conf_save(*name);<br>
> -                     name++;<br>
> +             while (pvl->path) {<br>
> +                     if (!tst_sys_conf_save(pvl->path))<br>
> +                             tst_sys_conf_set(pvl->path, pvl->val);<br>
<br>
Maybe it would be cleaner if we added tst_sys_conf_save_set() function<br>
instead of tst_sys_conf_set() that would do both, saved the value and<br>
set new one if non-NULL.<br></blockquote><div><br></div><div class="gmail_default" style="font-size:small">Yes, it can be. Actually, I started writing like that at the beginning.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">But I feel that tst_sys_conf_save_set() looks a bit longer and does more</div><div class="gmail_default" style="font-size:small">things. To split the set into a separate function is to respect the UNIX design</div><div class="gmail_default" style="font-size:small">philosophy (one function does one thing). Another important reason </div><div class="gmail_default" style="font-size:small">is to export tst_sys_conf_set() to global use instead of low-level macros</div><div class="gmail_default" style="font-size:small">for knob settings.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The rest suggestions sound good to me, thanks for reviewing!</div></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>