From 373cca0bf6834269c2b4fb6f27bcbf1c548ff983 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 12 Jan 2013 12:55:23 -0800 Subject: [PATCH] Formatting --- common.cpp | 2 +- expand.cpp | 2 +- expand.h | 2 +- fish_tests.cpp | 9 ++++++--- parser.cpp | 2 +- wutil.cpp | 15 ++++++++------- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/common.cpp b/common.cpp index 6f3fc2cb1..03d2763ad 100644 --- a/common.cpp +++ b/common.cpp @@ -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; diff --git a/expand.cpp b/expand.cpp index 1371a3748..860c6dec6 100644 --- a/expand.cpp +++ b/expand.cpp @@ -1644,7 +1644,7 @@ int expand_string(const wcstring &input, std::vector &output, expa { wcstring next = in->at(i).completion; - if (! (EXPAND_SKIP_HOME_DIRECTORIES & flags)) + if (!(EXPAND_SKIP_HOME_DIRECTORIES & flags)) expand_home_directory(next); diff --git a/expand.h b/expand.h index a4f7e2aba..dbacfd774 100644 --- a/expand.h +++ b/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 }; diff --git a/fish_tests.cpp b/fish_tests.cpp index 7cef02a64..7f2543389 100644 --- a/fish_tests.cpp +++ b/fish_tests.cpp @@ -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); } } diff --git a/parser.cpp b/parser.cpp index af68be8f2..76862479f 100644 --- a/parser.cpp +++ b/parser.cpp @@ -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) diff --git a/wutil.cpp b/wutil.cpp index fe5528217..0e52294d7 100644 --- a/wutil.cpp +++ b/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; }