[vlc-commits] network: remove unused net_Gets()
Rémi Denis-Courmont
git at videolan.org
Sun Nov 11 16:33:30 CET 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Nov 10 11:23:16 2018 +0200| [65f57dd3a5ee24d85315561a3a3cf0b4df275ce5] | committer: Rémi Denis-Courmont
network: remove unused net_Gets()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=65f57dd3a5ee24d85315561a3a3cf0b4df275ce5
---
include/vlc_network.h | 15 ---------------
src/libvlccore.sym | 1 -
src/network/io.c | 49 -------------------------------------------------
3 files changed, 65 deletions(-)
diff --git a/include/vlc_network.h b/include/vlc_network.h
index 1b5c7ddcae..055f2bcf8a 100644
--- a/include/vlc_network.h
+++ b/include/vlc_network.h
@@ -202,21 +202,6 @@ VLC_API ssize_t net_Read( vlc_object_t *p_this, int fd, void *p_data, size_t i_d
VLC_API ssize_t net_Write( vlc_object_t *p_this, int fd, const void *p_data, size_t i_data );
#define net_Write(a,b,c,d) net_Write(VLC_OBJECT(a),b,c,d)
-/**
- * Reads a line from a file descriptor.
- *
- * @warning
- * This function is not thread-safe; the same file descriptor I/O cannot be
- * read by another thread at the same time (although it can be written to).
- *
- * @note This only works with stream-oriented file descriptors, not with
- * datagram or packet-oriented ones.
- *
- * @return nul-terminated heap-allocated string, or NULL on I/O error.
- */
-VLC_API char * net_Gets( vlc_object_t *p_this, int fd );
-#define net_Gets(a,b) net_Gets(VLC_OBJECT(a),b)
-
VLC_API ssize_t net_Printf( vlc_object_t *p_this, int fd, const char *psz_fmt, ... ) VLC_FORMAT( 3, 4 );
#define net_Printf(o,fd,...) net_Printf(VLC_OBJECT(o),fd, __VA_ARGS__)
VLC_API ssize_t net_vaPrintf( vlc_object_t *p_this, int fd, const char *psz_fmt, va_list args );
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index e555ec22b6..02c02bc5dc 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -285,7 +285,6 @@ net_Accept
net_Connect
net_ConnectDgram
net_ConnectTCP
-net_Gets
net_Listen
net_ListenClose
net_OpenDgram
diff --git a/src/network/io.c b/src/network/io.c
index b29febf347..7e168327ac 100644
--- a/src/network/io.c
+++ b/src/network/io.c
@@ -484,55 +484,6 @@ ssize_t (net_Write)(vlc_object_t *obj, int fd, const void *buf, size_t len)
return written;
}
-#undef net_Gets
-char *net_Gets(vlc_object_t *obj, int fd)
-{
- char *buf = NULL;
- size_t size = 0, len = 0;
-
- for (;;)
- {
- if (len == size)
- {
- if (unlikely(size >= (1 << 16)))
- {
- errno = EMSGSIZE;
- goto error; /* put sane buffer size limit */
- }
-
- char *newbuf = realloc(buf, size + 1024);
- if (unlikely(newbuf == NULL))
- goto error;
- buf = newbuf;
- size += 1024;
- }
- assert(len < size);
-
- ssize_t val = vlc_recv_i11e(fd, buf + len, size - len, MSG_PEEK);
- if (val <= 0)
- goto error;
-
- char *end = memchr(buf + len, '\n', val);
- if (end != NULL)
- val = (end + 1) - (buf + len);
- if (recv(fd, buf + len, val, 0) != val)
- goto error;
- len += val;
- if (end != NULL)
- break;
- }
-
- assert(len > 0);
- buf[--len] = '\0';
- if (len > 0 && buf[--len] == '\r')
- buf[len] = '\0';
- return buf;
-error:
- msg_Err(obj, "read error: %s", vlc_strerror_c(errno));
- free(buf);
- return NULL;
-}
-
#undef net_Printf
ssize_t net_Printf( vlc_object_t *p_this, int fd, const char *psz_fmt, ... )
{
More information about the vlc-commits
mailing list