mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-09 03:51:20 -03:00
Some initial work on removing buffer_t from io_data_t
This commit is contained in:
20
io.cpp
20
io.cpp
@@ -91,7 +91,7 @@ void io_buffer_read( io_data_t *d )
|
||||
}
|
||||
else
|
||||
{
|
||||
b_append( d->param2.out_buffer, b, l );
|
||||
b_append( d->out_buffer, b, l );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,21 +100,20 @@ void io_buffer_read( io_data_t *d )
|
||||
|
||||
io_data_t *io_buffer_create( int is_input )
|
||||
{
|
||||
io_data_t *buffer_redirect = new io_data_t();
|
||||
std::auto_ptr<io_data_t> buffer_redirect(new io_data_t());
|
||||
|
||||
buffer_redirect->io_mode=IO_BUFFER;
|
||||
buffer_redirect->next=0;
|
||||
buffer_redirect->param2.out_buffer= (buffer_t *)malloc( sizeof(buffer_t));
|
||||
buffer_redirect->out_buffer= (buffer_t *)malloc( sizeof(buffer_t));
|
||||
buffer_redirect->is_input = is_input;
|
||||
b_init( buffer_redirect->param2.out_buffer );
|
||||
b_init( buffer_redirect->out_buffer );
|
||||
buffer_redirect->fd=is_input?0:1;
|
||||
|
||||
if( exec_pipe( buffer_redirect->param1.pipe_fd ) == -1 )
|
||||
{
|
||||
debug( 1, PIPE_ERROR );
|
||||
wperror (L"pipe");
|
||||
free( buffer_redirect->param2.out_buffer );
|
||||
free( buffer_redirect );
|
||||
free( buffer_redirect->out_buffer );
|
||||
return 0;
|
||||
}
|
||||
else if( fcntl( buffer_redirect->param1.pipe_fd[0],
|
||||
@@ -123,11 +122,10 @@ io_data_t *io_buffer_create( int is_input )
|
||||
{
|
||||
debug( 1, PIPE_ERROR );
|
||||
wperror( L"fcntl" );
|
||||
free( buffer_redirect->param2.out_buffer );
|
||||
free( buffer_redirect );
|
||||
free( buffer_redirect->out_buffer );
|
||||
return 0;
|
||||
}
|
||||
return buffer_redirect;
|
||||
return buffer_redirect.release();
|
||||
}
|
||||
|
||||
void io_buffer_destroy( io_data_t *io_buffer )
|
||||
@@ -149,9 +147,9 @@ void io_buffer_destroy( io_data_t *io_buffer )
|
||||
calling exec_read_io_buffer on the buffer
|
||||
*/
|
||||
|
||||
b_destroy( io_buffer->param2.out_buffer );
|
||||
b_destroy( io_buffer->out_buffer );
|
||||
|
||||
free( io_buffer->param2.out_buffer );
|
||||
free( io_buffer->out_buffer );
|
||||
delete io_buffer;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user