<p dir="ltr">Hello,</p>
<p dir="ltr">putenv() is a piece of crap almost on gets() level. I wouldn't be surprised if it is pr woll be deprecated by POSIX. Please, no.</p>
<p dir="ltr">Besides, I suspecy this breaks our own Linux code.</p>
<p dir="ltr">Le 30 sept. 2016 03:46, Steve Lhomme <robux4@videolabs.io> a écrit :<br>
><br>
> Since setenv() is leaky</p>
<p dir="ltr">And putenv() requires the caller to leak. No better.</p>
<p dir="ltr">> in the compat library this is a better choice.<br>
><br>
> Also that avoids having to link with the compatibility library for some tests.<br>
> ---<br>
> bin/vlc.c                    | 8 ++++----<br>
> test/libvlc/test.h           | 2 +-<br>
> test/modules/keystore/test.c | 2 +-<br>
> test/modules/misc/tls.c      | 2 +-<br>
> test/src/interface/dialog.c  | 2 +-<br>
> test/src/misc/keystore.c     | 2 +-<br>
> 6 files changed, 9 insertions(+), 9 deletions(-)<br>
><br>
> diff --git a/bin/vlc.c b/bin/vlc.c<br>
> index 0a33a0f..83e5991 100644<br>
> --- a/bin/vlc.c<br>
> +++ b/bin/vlc.c<br>
> @@ -124,15 +124,15 @@ int main( int i_argc, const char *ppsz_argv[] )<br>
><br>
> #ifndef NDEBUG<br>
>      /* Activate malloc checking routines to detect heap corruptions. */<br>
> -    setenv ("MALLOC_CHECK_", "2", 1);<br>
> +    putenv ("MALLOC_CHECK_=2");<br>
><br>
>      /* Disable the ugly Gnome crash dialog so that we properly segfault */<br>
> -    setenv ("GNOME_DISABLE_CRASH_DIALOG", "1", 1);<br>
> +    putenv ("GNOME_DISABLE_CRASH_DIALOG=1");<br>
> #endif<br>
><br>
> #ifdef TOP_BUILDDIR<br>
> -    setenv ("VLC_PLUGIN_PATH", TOP_BUILDDIR"/modules", 1);<br>
> -    setenv ("VLC_DATA_PATH", TOP_SRCDIR"/share", 1);<br>
> +    putenv ("VLC_PLUGIN_PATH="TOP_BUILDDIR"/modules");<br>
> +    putenv ("VLC_DATA_PATH="TOP_SRCDIR"/share");<br>
> #endif<br>
><br>
>      /* Clear the X.Org startup notification ID. Otherwise the UI might try to<br>
> diff --git a/test/libvlc/test.h b/test/libvlc/test.h<br>
> index 4e8356a..379d587 100644<br>
> --- a/test/libvlc/test.h<br>
> +++ b/test/libvlc/test.h<br>
> @@ -68,7 +68,7 @@ static inline void test_init (void)<br>
> {<br>
>      (void)test_default_sample; /* This one may not be used */<br>
>      alarm (10); /* Make sure "make check" does not get stuck */<br>
> -    setenv( "VLC_PLUGIN_PATH", "../modules", 1 );<br>
> +    putenv( "VLC_PLUGIN_PATH=../modules" );<br>
> }<br>
><br>
> #endif /* TEST_H */<br>
> diff --git a/test/modules/keystore/test.c b/test/modules/keystore/test.c<br>
> index 0ddb827..bfe7638 100644<br>
> --- a/test/modules/keystore/test.c<br>
> +++ b/test/modules/keystore/test.c<br>
> @@ -303,7 +303,7 @@ main(int i_argc, char *ppsz_argv[])<br>
>      if (!b_test_all)<br>
>          alarm(3);<br>
><br>
> -    setenv("VLC_PLUGIN_PATH", "../modules", 1);<br>
> +    putenv("VLC_PLUGIN_PATH=../modules");<br>
><br>
>      /* Create a dummy libvlc to initialize module bank, needed by module_exists */<br>
>      libvlc_instance_t *p_libvlc = libvlc_new(0, NULL);<br>
> diff --git a/test/modules/misc/tls.c b/test/modules/misc/tls.c<br>
> index 60898c6..81d87d3 100644<br>
> --- a/test/modules/misc/tls.c<br>
> +++ b/test/modules/misc/tls.c<br>
> @@ -158,7 +158,7 @@ int main(void)<br>
><br>
>      assert(!strncmp(homedir, "/tmp/vlc-test-", 14));<br>
>      setenv("HOME", homedir, 1);<br>
> -    setenv("VLC_PLUGIN_PATH", "../modules", 1);<br>
> +    putenv("VLC_PLUGIN_PATH=../modules");<br>
><br>
>      vlc = libvlc_new(0, NULL);<br>
>      assert(vlc != NULL);<br>
> diff --git a/test/src/interface/dialog.c b/test/src/interface/dialog.c<br>
> index d47ea80..65feadc 100644<br>
> --- a/test/src/interface/dialog.c<br>
> +++ b/test/src/interface/dialog.c<br>
> @@ -286,7 +286,7 @@ main(int i_argc, char *ppsz_argv[])<br>
>      if (!b_test_all)<br>
>          alarm(10);<br>
><br>
> -    setenv("VLC_PLUGIN_PATH", "../modules", 1);<br>
> +    putenv("VLC_PLUGIN_PATH=../modules");<br>
><br>
>      libvlc_instance_t *p_libvlc = libvlc_new(0, NULL);<br>
>      assert(p_libvlc != NULL);<br>
> diff --git a/test/src/misc/keystore.c b/test/src/misc/keystore.c<br>
> index a59f6f4..d62064d 100644<br>
> --- a/test/src/misc/keystore.c<br>
> +++ b/test/src/misc/keystore.c<br>
> @@ -301,7 +301,7 @@ create_libvlc(int i_vlc_argc, const char *const *ppsz_vlc_argv)<br>
> int<br>
> main(void)<br>
> {<br>
> -    setenv("VLC_PLUGIN_PATH", "../modules", 1);<br>
> +    putenv("VLC_PLUGIN_PATH=../modules");<br>
><br>
>      printf("creating tmp plaintext keystore file\n");<br>
>      char psz_tmp_path[] = "/tmp/libvlc_XXXXXX";<br>
> -- <br>
> 2.8.2<br>
><br>
> _______________________________________________<br>
> vlc-devel mailing list<br>
> To unsubscribe or modify your subscription options:<br>
> https://mailman.videolan.org/listinfo/vlc-devel<br></p>