summaryrefslogtreecommitdiff
path: root/mate-dictionary/libgdict/gdict-client-context.c
diff options
context:
space:
mode:
Diffstat (limited to 'mate-dictionary/libgdict/gdict-client-context.c')
-rw-r--r--mate-dictionary/libgdict/gdict-client-context.c47
1 files changed, 19 insertions, 28 deletions
diff --git a/mate-dictionary/libgdict/gdict-client-context.c b/mate-dictionary/libgdict/gdict-client-context.c
index 858abb4e..8bc9cbcd 100644
--- a/mate-dictionary/libgdict/gdict-client-context.c
+++ b/mate-dictionary/libgdict/gdict-client-context.c
@@ -1,20 +1,20 @@
-/* gdict-client-context.c -
+/* Copyright (C) 2005 Emmanuele Bassi <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
- * Copyright (C) 2005 Emmanuele Bassi <[email protected]>
+ * This file is part of MATE Utils.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * MATE Utils is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
*
- * This library is distributed in the hope that it will be useful,
+ * MATE Utils is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * You should have received a copy of the GNU General Public License
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
/**
@@ -30,7 +30,7 @@
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
#include <stdio.h>
@@ -239,8 +239,6 @@ static void gdict_client_context_real_disconnected (GdictClientContext *con
static GdictCommand *gdict_command_new (GdictCommandType cmd_type);
static void gdict_command_free (GdictCommand *cmd);
-
-
GQuark
gdict_client_context_error_quark (void)
{
@@ -409,8 +407,7 @@ gdict_client_context_set_property (GObject *object,
switch (prop_id)
{
case PROP_HOSTNAME:
- if (priv->hostname)
- g_free (priv->hostname);
+ g_free (priv->hostname);
priv->hostname = g_strdup (g_value_get_string (value));
gdict_client_context_clear_hostinfo (GDICT_CLIENT_CONTEXT (object));
break;
@@ -418,12 +415,11 @@ gdict_client_context_set_property (GObject *object,
priv->port = g_value_get_uint (value);
break;
case PROP_CLIENT_NAME:
- if (priv->client_name)
- g_free (priv->client_name);
+ g_free (priv->client_name);
priv->client_name = g_strdup (g_value_get_string (value));
break;
case GDICT_CONTEXT_PROP_LOCAL_ONLY:
- priv->local_only = g_value_get_boolean (value);
+ priv->local_only = (g_value_get_boolean (value) != FALSE);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -471,8 +467,7 @@ gdict_client_context_finalize (GObject *object)
/* force disconnection */
gdict_client_context_force_disconnect (context);
- if (priv->command)
- gdict_command_free (priv->command);
+ gdict_command_free (priv->command);
if (priv->commands_queue)
{
@@ -481,11 +476,8 @@ gdict_client_context_finalize (GObject *object)
priv->commands_queue = NULL;
}
- if (priv->client_name)
- g_free (priv->client_name);
-
- if (priv->hostname)
- g_free (priv->hostname);
+ g_free (priv->client_name);
+ g_free (priv->hostname);
#ifdef ENABLE_IPV6
if (priv->host6info)
@@ -1902,7 +1894,6 @@ gdict_client_context_connect (GdictClientContext *context,
#endif
((struct sockaddr_in *) &priv->sockaddr)->sin_port = g_htons (priv->port);
-
#ifdef ENABLE_IPV6
if (priv->sockaddr.ss_family == AF_INET6)
{