diff --git a/output.h b/output.h index e456e3463..2b7d9d318 100644 --- a/output.h +++ b/output.h @@ -149,7 +149,6 @@ int writeb( tputs_arg_t b ); */ void output_set_writer( int (*writer)(char) ); -//typedef int (*func_ptr_t)(char); /** Return the current output writer */ diff --git a/reader.cpp b/reader.cpp index 4385d7dfa..cd98cd186 100644 --- a/reader.cpp +++ b/reader.cpp @@ -1074,8 +1074,7 @@ static void completion_insert( const wchar_t *val, int flags ) static void run_pager( wchar_t *prefix, int is_quoted, const std::vector &comp ) { - string_buffer_t cmd; - string_buffer_t msg; + wcstring msg; wchar_t * prefix_esc; char *foo; io_data_t *in; @@ -1091,15 +1090,12 @@ static void run_pager( wchar_t *prefix, int is_quoted, const std::vectorfd = 3; @@ -1164,15 +1160,11 @@ static void run_pager( wchar_t *prefix, int is_quoted, const std::vectorparam2.out_buffer, foo, strlen(foo) ); free( foo ); @@ -1192,14 +1184,11 @@ static void run_pager( wchar_t *prefix, int is_quoted, const std::vectorfd = 4; parser_t &parser = parser_t::principal_parser(); - parser.eval( (wchar_t *)cmd.buff, out, TOP); + parser.eval( cmd, out, TOP); term_steal(); io_buffer_read( out ); - sb_destroy( &cmd ); - sb_destroy( &msg ); - int nil=0; b_append( out->param2.out_buffer, &nil, 1 ); @@ -1805,31 +1794,21 @@ void reader_replace_current_token( const wchar_t *new_token ) { const wchar_t *begin, *end; - string_buffer_t sb; int new_pos; - /* - Find current token - */ + /* Find current token */ const wchar_t *buff = data->command_line.c_str(); parse_util_token_extent( (wchar_t *)buff, data->buff_pos, &begin, &end, 0, 0 ); if( !begin || !end ) return; - /* - Make new string - */ - sb_init( &sb ); - sb_append_substring( &sb, buff, begin-buff ); - sb_append( &sb, new_token ); - sb_append( &sb, end ); - + /* Make new string */ + wcstring new_buff(buff, begin - buff); + new_buff.append(new_token); + new_buff.append(end); new_pos = (begin-buff) + wcslen(new_token); - - reader_set_buffer( (wchar_t *)sb.buff, new_pos ); - sb_destroy( &sb ); - + reader_set_buffer(new_buff, new_pos); } diff --git a/util.h b/util.h index ea7e52176..4d9ed1444 100644 --- a/util.h +++ b/util.h @@ -15,52 +15,6 @@ #include #include -/** - Typedef for a generic function pointer - */ -typedef void (*func_ptr_t)(); - -/** - A union of all types that can be stored in an array_list_t. This is - used to make sure that the pointer type can fit whatever we want to - insert. - */ -typedef union -{ - /** - long value - */ - long long_val; - /** - pointer value - */ - void *ptr_val; - /** - function pointer value - */ - func_ptr_t func_val; -} - anything_t; - -/** - Data structure for an automatically resizing dynamically allocated - priority queue. A priority queue allows quick retrieval of the - smallest element of a set (This implementation uses O(log n) time). - This implementation uses a heap for storing the queue. -*/ -typedef struct priority_queue -{ - /** Array contining the data */ - void **arr; - /** Number of elements*/ - int count; - /** Length of array */ - int size; - /** Comparison function */ - int (*compare)(void *e1, void *e2); -} -priority_queue_t; - /** Buffer for concatenating arbitrary data. */