mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Increase size of buffer for parser error string. Should change this to a dynamically allocated string.
darcs-hash:20060531154028-ac50b-ada120ecfe65bcf1ad1b3d1a5fad41ae9dec133c.gz
This commit is contained in:
parent
25365dbc54
commit
4722ddc373
2 changed files with 12 additions and 6 deletions
10
common.c
10
common.c
|
@ -547,9 +547,10 @@ void debug( int level, const wchar_t *msg, ... )
|
|||
|
||||
sb_init( &sb );
|
||||
sb_init( &sb2 );
|
||||
va_start( va, msg );
|
||||
|
||||
|
||||
sb_printf( &sb, L"%ls: ", program_name );
|
||||
|
||||
va_start( va, msg );
|
||||
sb_vprintf( &sb, msg, va );
|
||||
va_end( va );
|
||||
|
||||
|
@ -581,7 +582,7 @@ void write_screen( const wchar_t *msg, string_buffer_t *buff )
|
|||
*/
|
||||
while( *pos && ( !wcschr( L" \n\r\t", *pos ) ) )
|
||||
{
|
||||
|
||||
|
||||
/*
|
||||
Check is token is wider than one line.
|
||||
If so we mark it as an overflow and break the token.
|
||||
|
@ -606,7 +607,7 @@ void write_screen( const wchar_t *msg, string_buffer_t *buff )
|
|||
else if( overflow )
|
||||
{
|
||||
/*
|
||||
In case of overflow, we print a newline, except if we alreade are at position 0
|
||||
In case of overflow, we print a newline, except if we already are at position 0
|
||||
*/
|
||||
wchar_t *token = wcsndup( start, pos-start );
|
||||
if( line_width != 0 )
|
||||
|
@ -630,6 +631,7 @@ void write_screen( const wchar_t *msg, string_buffer_t *buff )
|
|||
free( token );
|
||||
line_width += (line_width!=0?1:0) + tok_width;
|
||||
}
|
||||
|
||||
/*
|
||||
Break on end of string
|
||||
*/
|
||||
|
|
8
parser.c
8
parser.c
|
@ -252,6 +252,10 @@ The fish parser. Contains functions for parsing code.
|
|||
#define UNKNOWN_BLOCK _( L"unknown/invalid block" )
|
||||
|
||||
|
||||
/**
|
||||
Size of the error string buffer
|
||||
*/
|
||||
#define ERR_STR_SZ 1024
|
||||
/** Last error code */
|
||||
int error_code;
|
||||
|
||||
|
@ -262,7 +266,7 @@ event_block_t *global_event_block=0;
|
|||
static int err_pos;
|
||||
|
||||
/** Description of last error */
|
||||
static wchar_t err_str[256];
|
||||
static wchar_t err_str[ERR_STR_SZ];
|
||||
|
||||
/** Pointer to the current tokenizer */
|
||||
static tokenizer *current_tokenizer;
|
||||
|
@ -698,7 +702,7 @@ void error( int ec, int p, const wchar_t *str, ... )
|
|||
err_pos = p;
|
||||
|
||||
va_start( va, str );
|
||||
vswprintf( err_str, 256, str, va );
|
||||
vswprintf( err_str, ERR_STR_SZ, str, va );
|
||||
va_end( va );
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue