mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 08:05:51 +08:00
Formatting
This commit is contained in:
parent
b32fcc7a8e
commit
373cca0bf6
|
@ -106,7 +106,7 @@ static char *wcs2str_internal(const wchar_t *in, char *out);
|
|||
void show_stackframe()
|
||||
{
|
||||
ASSERT_IS_NOT_FORKED_CHILD();
|
||||
|
||||
|
||||
/* Hack to avoid showing backtraces in the tester */
|
||||
if (program_name && ! wcscmp(program_name, L"(ignore)"))
|
||||
return;
|
||||
|
|
|
@ -1644,7 +1644,7 @@ int expand_string(const wcstring &input, std::vector<completion_t> &output, expa
|
|||
{
|
||||
wcstring next = in->at(i).completion;
|
||||
|
||||
if (! (EXPAND_SKIP_HOME_DIRECTORIES & flags))
|
||||
if (!(EXPAND_SKIP_HOME_DIRECTORIES & flags))
|
||||
expand_home_directory(next);
|
||||
|
||||
|
||||
|
|
2
expand.h
2
expand.h
|
@ -54,7 +54,7 @@ enum
|
|||
|
||||
/** Don't expand jobs (but you can still expand processes). This is because job expansion is not thread safe. */
|
||||
EXPAND_SKIP_JOBS = 1 << 8,
|
||||
|
||||
|
||||
/** Don't expand home directories */
|
||||
EXPAND_SKIP_HOME_DIRECTORIES = 1 << 9
|
||||
};
|
||||
|
|
|
@ -382,7 +382,8 @@ static int test_fork_helper(void *unused)
|
|||
for (i=0; i < 1000; i++)
|
||||
{
|
||||
//delete [](new char[4 * 1024 * 1024]);
|
||||
for (int j=0; j < 1024; j++) {
|
||||
for (int j=0; j < 1024; j++)
|
||||
{
|
||||
strerror(j);
|
||||
}
|
||||
}
|
||||
|
@ -421,8 +422,10 @@ static void test_fork(void)
|
|||
{
|
||||
/* Child */
|
||||
//new char[4 * 1024 * 1024];
|
||||
for (size_t i=0; i < 1024 * 16; i++) {
|
||||
for (int j=0; j < 256; j++) {
|
||||
for (size_t i=0; i < 1024 * 16; i++)
|
||||
{
|
||||
for (int j=0; j < 256; j++)
|
||||
{
|
||||
strerror(j);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3061,7 +3061,7 @@ int parser_t::test(const wchar_t * buff,
|
|||
arg_count=0;
|
||||
|
||||
command = tok_last(&tok);
|
||||
|
||||
|
||||
// Pass SKIP_HOME_DIRECTORIES for https://github.com/fish-shell/fish-shell/issues/512
|
||||
has_command = expand_one(command, EXPAND_SKIP_CMDSUBST | EXPAND_SKIP_VARIABLES | EXPAND_SKIP_HOME_DIRECTORIES);
|
||||
if (! has_command)
|
||||
|
|
15
wutil.cpp
15
wutil.cpp
|
@ -306,17 +306,17 @@ const char *safe_strerror(int err)
|
|||
else
|
||||
{
|
||||
int saved_err = errno;
|
||||
|
||||
|
||||
/* Use a shared buffer for this case */
|
||||
static char buff[384];
|
||||
char errnum_buff[64];
|
||||
format_long_safe(errnum_buff, err);
|
||||
|
||||
|
||||
buff[0] = '\0';
|
||||
safe_append(buff, "unknown error (errno was ", sizeof buff);
|
||||
safe_append(buff, errnum_buff, sizeof buff);
|
||||
safe_append(buff, ")", sizeof buff);
|
||||
|
||||
|
||||
errno = saved_err;
|
||||
return buff;
|
||||
}
|
||||
|
@ -326,17 +326,18 @@ void safe_perror(const char *message)
|
|||
{
|
||||
// Note we cannot use strerror, because on Linux it uses gettext, which is not safe
|
||||
int err = errno;
|
||||
|
||||
|
||||
char buff[384];
|
||||
buff[0] = '\0';
|
||||
|
||||
if (message) {
|
||||
|
||||
if (message)
|
||||
{
|
||||
safe_append(buff, message, sizeof buff);
|
||||
safe_append(buff, ": ", sizeof buff);
|
||||
}
|
||||
safe_append(buff, safe_strerror(err), sizeof buff);
|
||||
safe_append(buff, "\n", sizeof buff);
|
||||
|
||||
|
||||
write(STDERR_FILENO, buff, strlen(buff));
|
||||
errno = err;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user