mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-29 18:51:15 -03:00
Removed halloc_wcsdup
This commit is contained in:
@@ -59,8 +59,6 @@
|
|||||||
#include "signal.h"
|
#include "signal.h"
|
||||||
#include "exec.h"
|
#include "exec.h"
|
||||||
#include "highlight.h"
|
#include "highlight.h"
|
||||||
#include "halloc.h"
|
|
||||||
#include "halloc_util.h"
|
|
||||||
#include "parse_util.h"
|
#include "parse_util.h"
|
||||||
#include "parser_keywords.h"
|
#include "parser_keywords.h"
|
||||||
#include "expand.h"
|
#include "expand.h"
|
||||||
|
|||||||
2
exec.cpp
2
exec.cpp
@@ -46,8 +46,6 @@
|
|||||||
#include "expand.h"
|
#include "expand.h"
|
||||||
#include "signal.h"
|
#include "signal.h"
|
||||||
|
|
||||||
#include "halloc.h"
|
|
||||||
#include "halloc_util.h"
|
|
||||||
#include "parse_util.h"
|
#include "parse_util.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -74,19 +74,6 @@ void *halloc_register( void *context, void *data )
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar_t *halloc_wcsdup( void *context, const wchar_t *in )
|
|
||||||
{
|
|
||||||
size_t len=wcslen(in);
|
|
||||||
wchar_t *out = (wchar_t *)halloc( context, sizeof( wchar_t)*(len+1));
|
|
||||||
|
|
||||||
if( out == 0 )
|
|
||||||
{
|
|
||||||
DIE_MEM();
|
|
||||||
}
|
|
||||||
memcpy( out, in, sizeof( wchar_t)*(len+1));
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
wchar_t *halloc_wcsndup( void * context, const wchar_t *in, int c )
|
wchar_t *halloc_wcsndup( void * context, const wchar_t *in, int c )
|
||||||
{
|
{
|
||||||
wchar_t *res = (wchar_t *)halloc( context, sizeof(wchar_t)*(c+1) );
|
wchar_t *res = (wchar_t *)halloc( context, sizeof(wchar_t)*(c+1) );
|
||||||
|
|||||||
@@ -51,12 +51,6 @@ void halloc_register_function_void( void *context, void (*func)() );
|
|||||||
*/
|
*/
|
||||||
void *halloc_register( void *context, void *data );
|
void *halloc_register( void *context, void *data );
|
||||||
|
|
||||||
/**
|
|
||||||
Make a copy of the specified string using memory allocated using
|
|
||||||
halloc and the specified context
|
|
||||||
*/
|
|
||||||
wchar_t *halloc_wcsdup( void *context, const wchar_t *str );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Make a copy of the specified substring using memory allocated using
|
Make a copy of the specified substring using memory allocated using
|
||||||
halloc and the specified context
|
halloc and the specified context
|
||||||
|
|||||||
@@ -1245,7 +1245,7 @@ void parser_t::parse_job_argument_list( process_t *p,
|
|||||||
|
|
||||||
int matched_wildcard = 0, unmatched_wildcard = 0;
|
int matched_wildcard = 0, unmatched_wildcard = 0;
|
||||||
|
|
||||||
wchar_t *unmatched = 0;
|
wcstring unmatched;
|
||||||
int unmatched_pos=0;
|
int unmatched_pos=0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1374,9 +1374,9 @@ void parser_t::parse_job_argument_list( process_t *p,
|
|||||||
case EXPAND_WILDCARD_NO_MATCH:
|
case EXPAND_WILDCARD_NO_MATCH:
|
||||||
{
|
{
|
||||||
unmatched_wildcard = 1;
|
unmatched_wildcard = 1;
|
||||||
if( !unmatched )
|
if( unmatched.empty() )
|
||||||
{
|
{
|
||||||
unmatched = halloc_wcsdup( j, tok_last( tok ));
|
unmatched = tok_last(tok);
|
||||||
unmatched_pos = tok_get_pos( tok );
|
unmatched_pos = tok_get_pos( tok );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1589,7 +1589,7 @@ void parser_t::parse_job_argument_list( process_t *p,
|
|||||||
{
|
{
|
||||||
int tmp;
|
int tmp;
|
||||||
|
|
||||||
debug( 1, WILDCARD_ERR_MSG, unmatched );
|
debug( 1, WILDCARD_ERR_MSG, unmatched.c_str() );
|
||||||
tmp = current_tokenizer_pos;
|
tmp = current_tokenizer_pos;
|
||||||
current_tokenizer_pos = unmatched_pos;
|
current_tokenizer_pos = unmatched_pos;
|
||||||
|
|
||||||
|
|||||||
23
reader.cpp
23
reader.cpp
@@ -101,8 +101,6 @@ commence.
|
|||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "signal.h"
|
#include "signal.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "halloc.h"
|
|
||||||
#include "halloc_util.h"
|
|
||||||
#include "iothread.h"
|
#include "iothread.h"
|
||||||
#include "intern.h"
|
#include "intern.h"
|
||||||
|
|
||||||
@@ -1338,19 +1336,15 @@ static void reader_flash()
|
|||||||
exact replacement, e.g. if the COMPLETE_DONT_ESCAPE flag is set.
|
exact replacement, e.g. if the COMPLETE_DONT_ESCAPE flag is set.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int reader_can_replace( const wchar_t *in, int flags )
|
static int reader_can_replace( const wcstring &in, int flags )
|
||||||
{
|
{
|
||||||
|
|
||||||
const wchar_t * str = in;
|
const wchar_t * str = in.c_str();
|
||||||
|
|
||||||
if( flags & COMPLETE_DONT_ESCAPE )
|
if( flags & COMPLETE_DONT_ESCAPE )
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CHECK( in, 1 );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Test characters that have a special meaning in any character position
|
Test characters that have a special meaning in any character position
|
||||||
*/
|
*/
|
||||||
@@ -1382,20 +1376,17 @@ int reader_can_replace( const wchar_t *in, int flags )
|
|||||||
|
|
||||||
static int handle_completions( std::vector<completion_t> &comp )
|
static int handle_completions( std::vector<completion_t> &comp )
|
||||||
{
|
{
|
||||||
void *context = 0;
|
|
||||||
wchar_t *base = 0;
|
wchar_t *base = 0;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int done = 0;
|
int done = 0;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int flags=0;
|
int flags=0;
|
||||||
const wchar_t *begin, *end, *buff = data->command_line.c_str();
|
const wchar_t *begin, *end, *buff = data->command_line.c_str();
|
||||||
wchar_t *tok;
|
|
||||||
|
|
||||||
parse_util_token_extent( buff, data->buff_pos, &begin, 0, 0, 0 );
|
parse_util_token_extent( buff, data->buff_pos, &begin, 0, 0, 0 );
|
||||||
end = buff+data->buff_pos;
|
end = buff+data->buff_pos;
|
||||||
|
|
||||||
context = halloc( 0, 0 );
|
const wcstring tok(begin, end - begin);
|
||||||
tok = halloc_wcsndup( context, begin, end-begin );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Check trivial cases
|
Check trivial cases
|
||||||
@@ -1494,7 +1485,7 @@ static int handle_completions( std::vector<completion_t> &comp )
|
|||||||
if( begin )
|
if( begin )
|
||||||
{
|
{
|
||||||
|
|
||||||
int offset = wcslen( tok );
|
int offset = tok.size();
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|
||||||
@@ -1601,11 +1592,7 @@ static int handle_completions( std::vector<completion_t> &comp )
|
|||||||
s_reset( &data->screen, 1 );
|
s_reset( &data->screen, 1 );
|
||||||
reader_repaint();
|
reader_repaint();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
halloc_free( context );
|
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user