mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Replace some string_buffer_t
This commit is contained in:
parent
087940ec9e
commit
79a22b1f8d
3 changed files with 10 additions and 12 deletions
|
@ -198,7 +198,7 @@ static void check_connection()
|
|||
|
||||
env_universal_server.fd = -1;
|
||||
env_universal_server.killme=0;
|
||||
env_universal_server.input.used=0;
|
||||
env_universal_server.input.clear();
|
||||
env_universal_read_all();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -464,13 +464,13 @@ void read_message( connection_t *src )
|
|||
{
|
||||
src->killme = 1;
|
||||
debug( 3, L"Fd %d has reached eof, set killme flag", src->fd );
|
||||
if( src->input.used > 0 )
|
||||
if( src->input.size() > 0 )
|
||||
{
|
||||
char c = 0;
|
||||
b_append( &src->input, &c, 1 );
|
||||
src->input.push_back(c);
|
||||
debug( 1,
|
||||
L"Universal variable connection closed while reading command. Partial command recieved: '%s'",
|
||||
(wchar_t *)src->input.buff );
|
||||
&src->input.at(0));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -483,16 +483,16 @@ void read_message( connection_t *src )
|
|||
wchar_t *msg;
|
||||
|
||||
b = 0;
|
||||
b_append( &src->input, &b, 1 );
|
||||
src->input.push_back(b);
|
||||
|
||||
msg = utf2wcs( src->input.buff );
|
||||
msg = utf2wcs( &src->input.at(0) );
|
||||
|
||||
/*
|
||||
Before calling parse_message, we must empty reset
|
||||
everything, since the callback function could
|
||||
potentially call read_message.
|
||||
*/
|
||||
src->input.used=0;
|
||||
src->input.clear();
|
||||
|
||||
if( msg )
|
||||
{
|
||||
|
@ -500,7 +500,7 @@ void read_message( connection_t *src )
|
|||
}
|
||||
else
|
||||
{
|
||||
debug( 0, _(L"Could not convert message '%s' to wide character string"), src->input.buff );
|
||||
debug( 0, _(L"Could not convert message '%s' to wide character string"), &src->input.at(0) );
|
||||
}
|
||||
|
||||
free( msg );
|
||||
|
@ -508,7 +508,7 @@ void read_message( connection_t *src )
|
|||
}
|
||||
else
|
||||
{
|
||||
b_append( &src->input, &b, 1 );
|
||||
src->input.push_back(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -947,7 +947,6 @@ void connection_init( connection_t *c, int fd )
|
|||
{
|
||||
memset (c, 0, sizeof (connection_t));
|
||||
c->fd = fd;
|
||||
b_init( &c->input );
|
||||
c->unsent = new std::queue<message_t *>;
|
||||
c->buffer_consumed = c->buffer_used = 0;
|
||||
}
|
||||
|
@ -955,7 +954,6 @@ void connection_init( connection_t *c, int fd )
|
|||
void connection_destroy( connection_t *c)
|
||||
{
|
||||
if (c->unsent) delete c->unsent;
|
||||
b_destroy( &c->input );
|
||||
|
||||
/*
|
||||
A connection need not always be open - we only try to close it
|
||||
|
|
|
@ -93,7 +93,7 @@ typedef struct connection
|
|||
The input string. Input from the socket goes here. When a
|
||||
newline is encountered, the buffer is parsed and cleared.
|
||||
*/
|
||||
buffer_t input;
|
||||
std::vector<char> input;
|
||||
|
||||
/**
|
||||
The read buffer.
|
||||
|
|
Loading…
Reference in a new issue