From 9ad3488b5d076729b39bd3f91abda4fd10bea21c Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Fri, 27 May 2016 14:41:16 -0700 Subject: fix some style bogosities that crept in --- src/complete.cpp | 2 +- src/expand.cpp | 6 ++---- src/fallback.cpp | 8 +++++--- src/history.cpp | 11 ++++++----- src/parse_util.cpp | 4 ++-- src/parser_keywords.cpp | 2 +- src/proc.cpp | 4 +--- src/screen.cpp | 4 ++-- src/wcstringutil.cpp | 2 +- src/wgetopt.cpp | 4 ++-- src/wildcard.cpp | 4 +--- src/wutil.cpp | 6 +++--- 12 files changed, 27 insertions(+), 30 deletions(-) diff --git a/src/complete.cpp b/src/complete.cpp index 8c38b266..59da5a94 100644 --- a/src/complete.cpp +++ b/src/complete.cpp @@ -1340,7 +1340,7 @@ void complete(const wcstring &cmd_with_subcmds, std::vector *out_c } } - if (cmd_node && cmd_node->location_in_or_at_end_of_source_range(pos)) { + if (cmd_node && cmd_node->location_in_or_at_end_of_source_range(pos)) { // Complete command filename. completer.complete_cmd(current_token, use_function, use_builtin, use_command, use_implicit_cd); diff --git a/src/expand.cpp b/src/expand.cpp index f8cd7550..b69c79f8 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -917,8 +917,7 @@ static int expand_variables(const wcstring &instr, std::vector *ou wchar_t *slice_end; size_t bad_pos; - bad_pos = - parse_slice(in + slice_start, &slice_end, var_idx_list, var_pos_list, 1); + bad_pos = parse_slice(in + slice_start, &slice_end, var_idx_list, var_pos_list, 1); if (bad_pos != 0) { append_syntax_error(errors, stop_pos + bad_pos, L"Invalid index value"); is_ok = 0; @@ -931,8 +930,7 @@ static int expand_variables(const wcstring &instr, std::vector *ou long tmp = var_idx_list.at(j); if (tmp != 1) { size_t var_src_pos = var_pos_list.at(j); - append_syntax_error(errors, slice_start + var_src_pos, - ARRAY_BOUNDS_ERR); + append_syntax_error(errors, slice_start + var_src_pos, ARRAY_BOUNDS_ERR); is_ok = 0; return is_ok; } diff --git a/src/fallback.cpp b/src/fallback.cpp index dc5bcce2..b14b9243 100644 --- a/src/fallback.cpp +++ b/src/fallback.cpp @@ -148,11 +148,13 @@ int wcsncasecmp_use_weak(const wchar_t *s1, const wchar_t *s2, size_t n) { if (&wcsncasecmp != NULL) return (wcsncasecmp)(s1, s2, n); return wcsncasecmp_fallback(s1, s2, n); } -#else // __DARWIN_C_LEVEL >= 200809L +#else // __DARWIN_C_LEVEL >= 200809L wchar_t *wcsdup(const wchar_t *in) { return wcsdup_fallback(in); } int wcscasecmp(const wchar_t *a, const wchar_t *b) { return wcscasecmp_fallback(a, b); } -int wcsncasecmp(const wchar_t *a, const wchar_t *b, size_t n) { return wcsncasecmp_fallback(a, b, n); } -#endif // __DARWIN_C_LEVEL >= 200809L +int wcsncasecmp(const wchar_t *a, const wchar_t *b, size_t n) { + return wcsncasecmp_fallback(a, b, n); +} +#endif // __DARWIN_C_LEVEL >= 200809L #endif // __APPLE__ #ifndef HAVE_WCSNDUP diff --git a/src/history.cpp b/src/history.cpp index ca61ed3c..e849fb87 100644 --- a/src/history.cpp +++ b/src/history.cpp @@ -669,8 +669,7 @@ static size_t offset_of_next_item(const char *begin, size_t mmap_length, break; } case history_type_fish_1_x: { - result = - offset_of_next_item_fish_1_x(begin, mmap_length, inout_cursor); + result = offset_of_next_item_fish_1_x(begin, mmap_length, inout_cursor); break; } case history_type_unknown: { @@ -755,7 +754,8 @@ void history_t::save_internal_unless_disabled() { } // This might be a good candidate for moving to a background thread. - time_profiler_t profiler(vacuum ? "save_internal vacuum" : "save_internal no vacuum"); //!OCLINT(side-effect) + time_profiler_t profiler(vacuum ? "save_internal vacuum" + : "save_internal no vacuum"); //!OCLINT(side-effect) this->save_internal(vacuum); // Update our countdown. @@ -1414,7 +1414,7 @@ void history_t::disable_automatic_saving() { } void history_t::enable_automatic_saving() { - scoped_lock locker(lock); //!OCLINT(side-effect) + scoped_lock locker(lock); //!OCLINT(side-effect) assert(disable_automatic_save_counter > 0); // underflow disable_automatic_save_counter--; save_internal_unless_disabled(); @@ -1614,7 +1614,8 @@ static int threaded_perform_file_detection(file_detection_context_t *ctx) { return ctx->perform_file_detection(true /* test all */); } -static void perform_file_detection_done(file_detection_context_t *ctx, int success) { //!OCLINT(success is ignored) +static void perform_file_detection_done(file_detection_context_t *ctx, + int success) { //!OCLINT(success is ignored) ASSERT_IS_MAIN_THREAD(); // Now that file detection is done, update the history item with the valid file paths. diff --git a/src/parse_util.cpp b/src/parse_util.cpp index b78e4a8e..48ff6981 100644 --- a/src/parse_util.cpp +++ b/src/parse_util.cpp @@ -1054,12 +1054,12 @@ parser_test_error_bits_t parse_util_detect_errors_in_argument(const parse_node_t // We have something like $$$^.... Back up until we reach the first $. size_t first_dollar = idx; while (first_dollar > 0 && - (unesc.at(first_dollar - 1) == VARIABLE_EXPAND || + (unesc.at(first_dollar - 1) == VARIABLE_EXPAND || unesc.at(first_dollar - 1) == VARIABLE_EXPAND_SINGLE)) { first_dollar--; } parse_util_expand_variable_error(unesc, node.source_start, first_dollar, - out_errors); + out_errors); } } diff --git a/src/parser_keywords.cpp b/src/parser_keywords.cpp index 4a99dd94..f3a531dc 100644 --- a/src/parser_keywords.cpp +++ b/src/parser_keywords.cpp @@ -1,9 +1,9 @@ // Functions having to do with parser keywords, like testing if a function is a block command. #include "config.h" // IWYU pragma: keep -#include "parser_keywords.h" #include "common.h" #include "fallback.h" // IWYU pragma: keep +#include "parser_keywords.h" bool parser_keywords_skip_arguments(const wcstring &cmd) { return contains(cmd, L"else", L"begin"); diff --git a/src/proc.cpp b/src/proc.cpp index 2e370754..1a298b21 100644 --- a/src/proc.cpp +++ b/src/proc.cpp @@ -368,9 +368,7 @@ process_t::process_t() { } -process_t::~process_t() { - delete this->next; -} +process_t::~process_t() { delete this->next; } job_t::job_t(job_id_t jobid, const io_chain_t &bio) : block_io(bio), first_process(NULL), pgid(0), tmodes(), job_id(jobid), flags(0) {} diff --git a/src/screen.cpp b/src/screen.cpp index 882bd8d8..08fca25d 100644 --- a/src/screen.cpp +++ b/src/screen.cpp @@ -505,8 +505,8 @@ static void s_move(screen_t *s, data_buffer_t *b, int new_x, int new_y) { // Use the bulk ('multi') output for cursor movement if it is supported and it would be shorter // Note that this is required to avoid some visual glitches in iTerm (issue #1448). - bool use_multi = multi_str != NULL && multi_str[0] != '\0' && - abs(x_steps) * strlen(str) > strlen(multi_str); + bool use_multi = + multi_str != NULL && multi_str[0] != '\0' && abs(x_steps) * strlen(str) > strlen(multi_str); if (use_multi) { char *multi_param = tparm(multi_str, abs(x_steps)); writembs(multi_param); diff --git a/src/wcstringutil.cpp b/src/wcstringutil.cpp index 7e208469..163b0e8e 100644 --- a/src/wcstringutil.cpp +++ b/src/wcstringutil.cpp @@ -1,8 +1,8 @@ // Helper functions for working with wcstring. #include "config.h" // IWYU pragma: keep -#include "wcstringutil.h" #include "common.h" +#include "wcstringutil.h" typedef wcstring::size_type size_type; diff --git a/src/wgetopt.cpp b/src/wgetopt.cpp index 41b7896a..f7ed5427 100644 --- a/src/wgetopt.cpp +++ b/src/wgetopt.cpp @@ -307,8 +307,8 @@ int wgetopter_t::_wgetopt_internal(int argc, wchar_t **argv, const wchar_t *opts int option_index; for (nameend = nextchar; *nameend && *nameend != '='; nameend++) { - // Do nothing. - } + // Do nothing. + } // Test all long options for either exact match or abbreviated matches. for (p = longopts, option_index = 0; p->name; p++, option_index++) diff --git a/src/wildcard.cpp b/src/wildcard.cpp index b48fe763..9438ea29 100644 --- a/src/wildcard.cpp +++ b/src/wildcard.cpp @@ -290,9 +290,7 @@ static bool wildcard_complete_internal(const wchar_t *str, const wchar_t *wc, // We don't even try with this one. return false; } - default: { - assert(0 && "Unreachable code reached"); - } + default: { assert(0 && "Unreachable code reached"); } } assert(0 && "Unreachable code reached"); diff --git a/src/wutil.cpp b/src/wutil.cpp index 9f975fab..3b0bdb2e 100644 --- a/src/wutil.cpp +++ b/src/wutil.cpp @@ -344,9 +344,9 @@ wchar_t *wrealpath(const wcstring &pathname, wchar_t *resolved_path) { } #if __APPLE__ && __DARWIN_C_LEVEL < 200809L - // OS X Snow Leopard is broken with respect to the dynamically allocated buffer returned by - // realpath(). It's not dynamically allocated so attempting to free that buffer triggers a - // malloc/free error. Thus we don't attempt the free in this case. +// OS X Snow Leopard is broken with respect to the dynamically allocated buffer returned by +// realpath(). It's not dynamically allocated so attempting to free that buffer triggers a +// malloc/free error. Thus we don't attempt the free in this case. #else free(narrow_res); #endif -- cgit v1.2.3