[Spice-devel] [spice-common 8/8] Use g_getenv() instead of getenv()

Frediano Ziglio fziglio at redhat.com
Mon Apr 25 09:06:46 UTC 2016


> 
> ---
>  common/log.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/common/log.c b/common/log.c
> index 8d47cb6..91d3181 100644
> --- a/common/log.c
> +++ b/common/log.c
> @@ -59,7 +59,7 @@ static GLogLevelFlags spice_log_level_to_glib(SpiceLogLevel
> level)
>  static void spice_log_set_debug_level(void)
>  {
>      if (glib_debug_level == 0) {
> -        char *debug_str = getenv("SPICE_DEBUG_LEVEL");
> +        char *debug_str = (char *)g_getenv("SPICE_DEBUG_LEVEL");

You should change the variable to const char *, we don't need to
change the environment.

>          if (debug_str != NULL) {
>              int debug_level;
>              char *debug_env;
> @@ -93,7 +93,7 @@ static void spice_log_set_debug_level(void)
>  static void spice_log_set_abort_level(void)
>  {
>      if (abort_level == -1) {
> -        char *abort_str = getenv("SPICE_ABORT_LEVEL");
> +        char *abort_str = (char *)g_getenv("SPICE_ABORT_LEVEL");
>          if (abort_str != NULL) {
>              GLogLevelFlags glib_abort_level;
>  

Frediano


More information about the Spice-devel mailing list