mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-01 04:41:14 -03:00
Eliminate wcsv2strv
This commit is contained in:
21
common.cpp
21
common.cpp
@@ -383,27 +383,6 @@ static char *wcs2str_internal(const wchar_t *in, char *out)
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
char **wcsv2strv(const wchar_t * const *in)
|
|
||||||
{
|
|
||||||
size_t i, count = 0;
|
|
||||||
|
|
||||||
while (in[count] != 0)
|
|
||||||
count++;
|
|
||||||
char **res = (char **)malloc(sizeof(char *)*(count+1));
|
|
||||||
if (res == 0)
|
|
||||||
{
|
|
||||||
DIE_MEM();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i=0; i<count; i++)
|
|
||||||
{
|
|
||||||
res[i]=wcs2str(in[i]);
|
|
||||||
}
|
|
||||||
res[count]=0;
|
|
||||||
return res;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
wcstring format_string(const wchar_t *format, ...)
|
wcstring format_string(const wchar_t *format, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
|
|||||||
6
common.h
6
common.h
@@ -682,12 +682,6 @@ wcstring vformat_string(const wchar_t *format, va_list va_orig);
|
|||||||
void append_format(wcstring &str, const wchar_t *format, ...);
|
void append_format(wcstring &str, const wchar_t *format, ...);
|
||||||
void append_formatv(wcstring &str, const wchar_t *format, va_list ap);
|
void append_formatv(wcstring &str, const wchar_t *format, va_list ap);
|
||||||
|
|
||||||
/**
|
|
||||||
Returns a newly allocated wide character string array equivalent of
|
|
||||||
the specified multibyte character string array
|
|
||||||
*/
|
|
||||||
char **wcsv2strv(const wchar_t * const *in);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Test if the given string is a valid variable name.
|
Test if the given string is a valid variable name.
|
||||||
|
|
||||||
|
|||||||
6
exec.cpp
6
exec.cpp
@@ -361,12 +361,14 @@ static void launch_process_nofork(process_t *p)
|
|||||||
ASSERT_IS_MAIN_THREAD();
|
ASSERT_IS_MAIN_THREAD();
|
||||||
ASSERT_IS_NOT_FORKED_CHILD();
|
ASSERT_IS_NOT_FORKED_CHILD();
|
||||||
|
|
||||||
char **argv = wcsv2strv(p->get_argv());
|
null_terminated_array_t<char> argv_array;
|
||||||
|
convert_wide_array_to_narrow(p->get_argv_array(), &argv_array);
|
||||||
|
|
||||||
const char *const *envv = env_export_arr(false);
|
const char *const *envv = env_export_arr(false);
|
||||||
char *actual_cmd = wcs2str(p->actual_cmd.c_str());
|
char *actual_cmd = wcs2str(p->actual_cmd.c_str());
|
||||||
|
|
||||||
/* Bounce to launch_process. This never returns. */
|
/* Bounce to launch_process. This never returns. */
|
||||||
safe_launch_process(p, actual_cmd, argv, envv);
|
safe_launch_process(p, actual_cmd, argv_array.get(), envv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user