os: xtrans: simplify _XSERVTransWriteV()

Refactor _XSERVTransWriteV() to call write() on Unix and instead drop
the WRITEV() macro.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-07-30 20:08:13 +02:00
committed by Enrico Weigelt
parent e46f51cee9
commit b738a28098
4 changed files with 6 additions and 17 deletions

View File

@@ -1028,14 +1028,12 @@ int _XSERVTransMakeAllCOTSServerListeners (const char *port, int *partial,
* may be used by it.
*/
#ifdef WIN32
/*
* emulate writev
*/
static int _XSERVTransWriteV (XtransConnInfo ciptr, struct iovec *iov, size_t iovcnt)
{
#ifdef WIN32
int i, len, total;
char *base;
@@ -1055,6 +1053,7 @@ static int _XSERVTransWriteV (XtransConnInfo ciptr, struct iovec *iov, size_t io
}
}
return total;
#else
return writev(ciptr->fd, iov, iovcnt);
#endif
}
#endif /* WIN32 */

View File

@@ -249,18 +249,8 @@ typedef struct _Xtransport_table {
#pragma clang diagnostic ignored "-Wunused-function"
#endif
#ifdef WIN32
#define WRITEV(ciptr, iov, iovcnt) _XSERVTransWriteV(ciptr, iov, iovcnt)
static int _XSERVTransWriteV(XtransConnInfo ciptr, struct iovec *iov, size_t iovcnt);
#else
#define WRITEV(ciptr, iov, iovcnt) writev(ciptr->fd, iov, iovcnt)
#endif /* WIN32 */
static int trans_mkdir (
const char *, /* path */
int /* mode */

View File

@@ -765,7 +765,7 @@ static ssize_t _XSERVTransLocalWritev(XtransConnInfo ciptr, struct iovec *iov, s
{
prmsg(2,"LocalWritev(%d,%p,%d)\n", ciptr->fd, (const void *) iov, iovcnt);
return WRITEV(ciptr,iov,iovcnt);
return _XSERVTransWriteV(ciptr,iov,iovcnt);
}
static int _XSERVTransLocalDisconnect(XtransConnInfo ciptr)

View File

@@ -1377,7 +1377,7 @@ static ssize_t _XSERVTransSocketWritev (
return i;
}
#endif
return WRITEV (ciptr, iov, iovcnt);
return _XSERVTransWriteV(ciptr, iov, iovcnt);
}
static ssize_t _XSERVTransSocketWrite (