mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
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:
committed by
Enrico Weigelt
parent
e46f51cee9
commit
b738a28098
@@ -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 */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user