Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
---
include/qemu/sockets.h | 15 ---------------
util/qemu-sockets.c | 34 ----------------------------------
2 files changed, 49 deletions(-)
diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h
index 7abffc4..8eb0172 100644
--- a/include/qemu/sockets.h
+++ b/include/qemu/sockets.h
@@ -106,21 +106,6 @@ SocketAddress *socket_local_address(int fd, Error **errp);
SocketAddress *socket_remote_address(int fd, Error **errp);
/**
- * socket_address_to_string:
- * @addr: the socket address struct
- * @errp: pointer to uninitialized error object
- *
- * Get the string representation of the socket
- * address. A pointer to the char array containing
- * string format will be returned, the caller is
- * required to release the returned value when no
- * longer required with g_free.
- *
- * Returns: the socket address in string format, or NULL on error
- */
-char *socket_address_to_string(struct SocketAddress *addr, Error **errp);
-
-/**
* socket_address_flatten:
* @addr: the socket address to flatten
*
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index b39ae74..08b1a26 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -1301,40 +1301,6 @@ SocketAddress *socket_remote_address(int fd, Error **errp)
return socket_sockaddr_to_address(&ss, sslen, errp);
}
-char *socket_address_to_string(struct SocketAddress *addr, Error **errp)
-{
- char *buf;
- InetSocketAddress *inet;
-
- switch (addr->type) {
- case SOCKET_ADDRESS_TYPE_INET:
- inet = &addr->u.inet;
- if (strchr(inet->host, ':') == NULL) {
- buf = g_strdup_printf("%s:%s", inet->host, inet->port);
- } else {
- buf = g_strdup_printf("[%s]:%s", inet->host, inet->port);
- }
- break;
-
- case SOCKET_ADDRESS_TYPE_UNIX:
- buf = g_strdup(addr->u.q_unix.path);
- break;
-
- case SOCKET_ADDRESS_TYPE_FD:
- buf = g_strdup(addr->u.fd.str);
- break;
-
- case SOCKET_ADDRESS_TYPE_VSOCK:
- buf = g_strdup_printf("%s:%s",
- addr->u.vsock.cid,
- addr->u.vsock.port);
- break;
-
- default:
- abort();
- }
- return buf;
-}
SocketAddress *socket_address_flatten(SocketAddressLegacy *addr_legacy)
{
--
2.9.3
Mao Zhongyi <maozy.fnst@cn.fujitsu.com> writes: > Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com> socket_address_to_string() was added in commit 7e84495 "Change net/socket.c to use socket_*() functions". The commit was reverted (commit 6160183), but the revert left in the helper. It was then redone (commit 883e4f7), and reverted again (commit 6701e55). No other users have emerged. If they ever do, the helper is one git-revert away. Reviewed-by: Markus Armbruster <armbru@redhat.com>
Cc: qemu-trivial@nongnu.org
On 08/06/2017 05:11, Mao Zhongyi wrote:
> Signed-off-by: Mao Zhongyi <maozy.fnst@cn.fujitsu.com>
> ---
> include/qemu/sockets.h | 15 ---------------
> util/qemu-sockets.c | 34 ----------------------------------
> 2 files changed, 49 deletions(-)
>
> diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h
> index 7abffc4..8eb0172 100644
> --- a/include/qemu/sockets.h
> +++ b/include/qemu/sockets.h
> @@ -106,21 +106,6 @@ SocketAddress *socket_local_address(int fd, Error **errp);
> SocketAddress *socket_remote_address(int fd, Error **errp);
>
> /**
> - * socket_address_to_string:
> - * @addr: the socket address struct
> - * @errp: pointer to uninitialized error object
> - *
> - * Get the string representation of the socket
> - * address. A pointer to the char array containing
> - * string format will be returned, the caller is
> - * required to release the returned value when no
> - * longer required with g_free.
> - *
> - * Returns: the socket address in string format, or NULL on error
> - */
> -char *socket_address_to_string(struct SocketAddress *addr, Error **errp);
> -
> -/**
> * socket_address_flatten:
> * @addr: the socket address to flatten
> *
> diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
> index b39ae74..08b1a26 100644
> --- a/util/qemu-sockets.c
> +++ b/util/qemu-sockets.c
> @@ -1301,40 +1301,6 @@ SocketAddress *socket_remote_address(int fd, Error **errp)
> return socket_sockaddr_to_address(&ss, sslen, errp);
> }
>
> -char *socket_address_to_string(struct SocketAddress *addr, Error **errp)
> -{
> - char *buf;
> - InetSocketAddress *inet;
> -
> - switch (addr->type) {
> - case SOCKET_ADDRESS_TYPE_INET:
> - inet = &addr->u.inet;
> - if (strchr(inet->host, ':') == NULL) {
> - buf = g_strdup_printf("%s:%s", inet->host, inet->port);
> - } else {
> - buf = g_strdup_printf("[%s]:%s", inet->host, inet->port);
> - }
> - break;
> -
> - case SOCKET_ADDRESS_TYPE_UNIX:
> - buf = g_strdup(addr->u.q_unix.path);
> - break;
> -
> - case SOCKET_ADDRESS_TYPE_FD:
> - buf = g_strdup(addr->u.fd.str);
> - break;
> -
> - case SOCKET_ADDRESS_TYPE_VSOCK:
> - buf = g_strdup_printf("%s:%s",
> - addr->u.vsock.cid,
> - addr->u.vsock.port);
> - break;
> -
> - default:
> - abort();
> - }
> - return buf;
> -}
>
> SocketAddress *socket_address_flatten(SocketAddressLegacy *addr_legacy)
> {
>
© 2016 - 2025 Red Hat, Inc.