fix some style bogosities that crept in

This commit is contained in:
Kurtis Rader 2016-05-27 14:41:16 -07:00
parent 8f420b9272
commit 9ad3488b5d
12 changed files with 27 additions and 30 deletions

View File

@ -1340,7 +1340,7 @@ void complete(const wcstring &cmd_with_subcmds, std::vector<completion_t> *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);

View File

@ -917,8 +917,7 @@ static int expand_variables(const wcstring &instr, std::vector<completion_t> *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<completion_t> *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;
}

View File

@ -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

View File

@ -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.

View File

@ -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);
}
}

View File

@ -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");

View File

@ -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) {}

View File

@ -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);

View File

@ -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;

View File

@ -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++)

View File

@ -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");

View File

@ -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