[evolution-data-server] Remove unused camel_getnameinfo().



commit 245497a0a399464922814e053ed304fec7b90090
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Sep 26 21:05:21 2013 -0400

    Remove unused camel_getnameinfo().

 camel/camel-net-utils.c                 |  132 -------------------------------
 camel/camel-net-utils.h                 |    7 --
 docs/reference/camel/camel-sections.txt |    1 -
 3 files changed, 0 insertions(+), 140 deletions(-)
---
diff --git a/camel/camel-net-utils.c b/camel/camel-net-utils.c
index a83c847..7b9f555 100644
--- a/camel/camel-net-utils.c
+++ b/camel/camel-net-utils.c
@@ -769,135 +769,3 @@ camel_freeaddrinfo (struct addrinfo *host)
 #endif
 }
 
-#ifdef NEED_ADDRINFO
-static gpointer
-cs_getnameinfo (gpointer data)
-{
-       struct _addrinfo_msg *msg = data;
-       gint herr;
-       struct hostent h;
-       struct sockaddr_in *sin = (struct sockaddr_in *) msg->addr;
-
-       /* FIXME: error code */
-       if (msg->addr->sa_family != AF_INET) {
-               msg->result = -1;
-               return NULL;
-       }
-
-       /* FIXME: honour getnameinfo flags: do we care, not really */
-
-       while ((msg->result = camel_gethostbyaddr_r ((const gchar *) &sin->sin_addr, sizeof (sin->sin_addr), 
AF_INET, &h,
-                                                   msg->hostbufmem, msg->hostbuflen, &herr)) == ERANGE) {
-               if (msg->cancelled)
-                       break;
-               msg->hostbuflen *= 2;
-               msg->hostbufmem = g_realloc (msg->hostbufmem, msg->hostbuflen);
-       }
-
-       if (msg->cancelled)
-               goto cancel;
-
-       if (msg->host) {
-               g_free (msg->host);
-               if (msg->result == 0 && h.h_name && h.h_name[0]) {
-                       msg->host = g_strdup (h.h_name);
-               } else {
-                       guchar *in = (guchar *) &sin->sin_addr;
-
-                       /* sin_addr is always network order which is big-endian */
-                       msg->host = g_strdup_printf ("%u.%u.%u.%u", in[0], in[1], in[2], in[3]);
-               }
-       }
-
-       /* we never actually use this anyway */
-       if (msg->serv)
-               sprintf (msg->serv, "%d", sin->sin_port);
-
-       if (!msg->cancelled)
-               camel_msgport_reply ((CamelMsg *) msg);
-cancel:
-       return NULL;
-}
-#else
-static gpointer
-cs_getnameinfo (gpointer data)
-{
-       struct _addrinfo_msg *msg = data;
-
-       /* there doens't appear to be a return code which says host or serv buffers are too short, lengthen 
them */
-       msg->result = getnameinfo (msg->addr, msg->addrlen, msg->host, msg->hostlen, msg->serv, msg->servlen, 
msg->flags);
-
-       if (!msg->cancelled)
-               camel_msgport_reply ((CamelMsg *) msg);
-
-       return NULL;
-}
-#endif
-
-/**
- * camel_getnameinfo:
- *
- * Since: 2.22
- **/
-gint
-camel_getnameinfo (const struct sockaddr *sa,
-                   socklen_t salen,
-                   gchar **host,
-                   gchar **serv,
-                   gint flags,
-                   GCancellable *cancellable,
-                   GError **error)
-{
-       struct _addrinfo_msg *msg;
-       gint result;
-
-       if (g_cancellable_set_error_if_cancelled (cancellable, error))
-               return -1;
-
-       camel_operation_push_message (
-               cancellable, _("Resolving address"));
-
-       msg = g_malloc0 (sizeof (*msg));
-       msg->addr = sa;
-       msg->addrlen = salen;
-       if (host) {
-               msg->hostlen = NI_MAXHOST;
-               msg->host = g_malloc (msg->hostlen);
-               msg->host[0] = 0;
-       }
-       if (serv) {
-               msg->servlen = NI_MAXSERV;
-               msg->serv = g_malloc (msg->servlen);
-               msg->serv[0] = 0;
-       }
-       msg->flags = flags;
-#ifdef NEED_ADDRINFO
-       msg->hostbuflen = 1024;
-       msg->hostbufmem = g_malloc (msg->hostbuflen);
-#endif
-       cs_waitinfo (
-               cs_getnameinfo, msg, _("Name lookup failed"),
-               cancellable, error);
-
-       result = msg->result;
-       if (result == EAI_NONAME || result == EAI_FAIL) {
-               g_set_error_literal (
-                       error, CAMEL_SERVICE_ERROR, CAMEL_SERVICE_ERROR_URL_INVALID,
-                       _("Name lookup failed. Check your host name for spelling errors."));
-       } else if (result) {
-               g_set_error (
-                       error, CAMEL_SERVICE_ERROR, CAMEL_SERVICE_ERROR_URL_INVALID,
-                       _("Name lookup failed: %s"), gai_strerror (result));
-       } else {
-               if (host)
-                       *host = g_strdup(msg->host);
-               if (serv)
-                       *serv = g_strdup(msg->serv);
-       }
-
-       cs_freeinfo (msg);
-
-       camel_operation_pop_message (cancellable);
-
-       return result;
-}
diff --git a/camel/camel-net-utils.h b/camel/camel-net-utils.h
index dd544dc..844d4b2 100644
--- a/camel/camel-net-utils.h
+++ b/camel/camel-net-utils.h
@@ -96,13 +96,6 @@ struct addrinfo *
                                                 GCancellable *cancellable,
                                                 GError **error);
 void           camel_freeaddrinfo              (struct addrinfo *host);
-gint           camel_getnameinfo               (const struct sockaddr *sa,
-                                                socklen_t salen,
-                                                gchar **host,
-                                                gchar **serv,
-                                                gint flags,
-                                                GCancellable *cancellable,
-                                                GError **error);
 
 G_END_DECLS
 
diff --git a/docs/reference/camel/camel-sections.txt b/docs/reference/camel/camel-sections.txt
index 22fc1cf..2bf3582 100644
--- a/docs/reference/camel/camel-sections.txt
+++ b/docs/reference/camel/camel-sections.txt
@@ -3372,7 +3372,6 @@ NI_NAMEREQD
 NI_DGRAM
 camel_getaddrinfo
 camel_freeaddrinfo
-camel_getnameinfo
 <SUBSECTION Private>
 addrinfo
 sockaddr


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]