From c769f3e776163d3436347e114126de38fde9b7cf Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 26 Jan 2012 15:08:31 +0000 Subject: [PATCH 2/3] Use g_getenv and g_strtoull instead of getenv and atoi We don't include stdlib.h (except accidentally, via gcrypt.h), which we should if we're going to use its functions. In both cases GLib has a portable version, and our coding style is generally to prefer the GLib versions of things, so let's use those. --- wocky/wocky-tls.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wocky/wocky-tls.c b/wocky/wocky-tls.c index 855b9e6..796ac47 100644 --- a/wocky/wocky-tls.c +++ b/wocky/wocky-tls.c @@ -1433,7 +1433,7 @@ static void wocky_tls_session_init (WockyTLSSession *session) { const char *level; - guint lvl = 0; + guint64 lvl = 0; static gsize initialised; if G_UNLIKELY (g_once_init_enter (&initialised)) @@ -1443,8 +1443,8 @@ wocky_tls_session_init (WockyTLSSession *session) g_once_init_leave (&initialised, 1); } - if ((level = getenv ("WOCKY_TLS_DEBUG_LEVEL")) != NULL) - lvl = atoi (level); + if ((level = g_getenv ("WOCKY_TLS_DEBUG_LEVEL")) != NULL) + lvl = g_ascii_strtoull (level, NULL, 10); tls_debug_level = lvl; gnutls_global_set_log_level (lvl); @@ -1481,7 +1481,7 @@ wocky_tls_session_set_property (GObject *object, guint prop_id, static const char * tls_options (void) { - const char *options = getenv ("WOCKY_GNUTLS_OPTIONS"); + const char *options = g_getenv ("WOCKY_GNUTLS_OPTIONS"); return (options != NULL && *options != '\0') ? options : DEFAULT_TLS_OPTIONS; } -- 1.7.8.3