mirror of
https://github.com/neovim/neovim.git
synced 2025-10-16 06:46:07 +00:00
refactor(io): separate types for read and write streams
This is a structural refactor with no logical changes, yet. Done in preparation for simplifying rstream/rbuffer which will require more state inline in RStream. The initial idea was to have RStream and WStream as sub-types symetrically but that doesn't work, as sockets are both reading and writing. Also there is very little write-specific state to start with, so the benefit of a separate WStream struct is a lot smaller. Just document what fields in `Stream` are write specific.
This commit is contained in:
@@ -30,7 +30,7 @@ struct Channel {
|
||||
Process proc;
|
||||
LibuvProcess uv;
|
||||
PtyProcess pty;
|
||||
Stream socket;
|
||||
RStream socket;
|
||||
StdioPair stdio;
|
||||
StderrState err;
|
||||
InternalState internal;
|
||||
@@ -73,7 +73,7 @@ static inline Stream *channel_instream(Channel *chan)
|
||||
return &chan->stream.proc.in;
|
||||
|
||||
case kChannelStreamSocket:
|
||||
return &chan->stream.socket;
|
||||
return &chan->stream.socket.s;
|
||||
|
||||
case kChannelStreamStdio:
|
||||
return &chan->stream.stdio.out;
|
||||
@@ -85,10 +85,10 @@ static inline Stream *channel_instream(Channel *chan)
|
||||
abort();
|
||||
}
|
||||
|
||||
static inline Stream *channel_outstream(Channel *chan)
|
||||
static inline RStream *channel_outstream(Channel *chan)
|
||||
REAL_FATTR_NONNULL_ALL;
|
||||
|
||||
static inline Stream *channel_outstream(Channel *chan)
|
||||
static inline RStream *channel_outstream(Channel *chan)
|
||||
{
|
||||
switch (chan->streamtype) {
|
||||
case kChannelStreamProc:
|
||||
|
Reference in New Issue
Block a user