Lint Cleanup

This remove some stores that clang assures me are very dead.

And an assert() for an unlikely NULL pointer dereference I can't quite
figure out.
This commit is contained in:
Aaron Gyes 2016-06-14 19:21:50 -07:00
parent d70be18c42
commit 9f0c31611c
7 changed files with 11 additions and 13 deletions

View File

@ -749,7 +749,7 @@ wcstring reformat_for_screen(const wcstring &msg) {
// If token is zero character long, we don't do anything. // If token is zero character long, we don't do anything.
if (pos == start) { if (pos == start) {
start = pos = pos + 1; pos = pos + 1;
} else if (overflow) { } else if (overflow) {
// In case of overflow, we print a newline, except if we already are at position 0. // In case of overflow, we print a newline, except if we already are at position 0.
wchar_t *token = wcsndup(start, pos - start); wchar_t *token = wcsndup(start, pos - start);

View File

@ -185,8 +185,6 @@ static struct config_paths_t determine_config_directory_paths(const char *argv0)
paths.sysconf = L"" SYSCONFDIR "/fish"; paths.sysconf = L"" SYSCONFDIR "/fish";
paths.doc = L"" DOCDIR; paths.doc = L"" DOCDIR;
paths.bin = L"" BINDIR; paths.bin = L"" BINDIR;
done = true;
} }
return paths; return paths;

View File

@ -1387,7 +1387,7 @@ void history_t::save_internal(bool vacuum) {
} }
if (!ok) { if (!ok) {
// We did not or could not append; rewrite the file ("vacuum" it). // We did not or could not append; rewrite the file ("vacuum" it).
ok = this->save_internal_via_rewrite(); this->save_internal_via_rewrite();
} }
} }

View File

@ -128,9 +128,9 @@ line_t pager_t::completion_print_item(const wcstring &prefix, const comp_t *c, s
{ {
written += print_max(L" ", packed_color, 1, false, &line_data); written += print_max(L" ", packed_color, 1, false, &line_data);
} }
written += print_max(L"(", packed_color, 1, false, &line_data); print_max(L"(", packed_color, 1, false, &line_data);
written += print_max(c->desc, packed_color, desc_width, false, &line_data); print_max(c->desc, packed_color, desc_width, false, &line_data);
written += print_max(L")", packed_color, 1, false, &line_data); print_max(L")", packed_color, 1, false, &line_data);
} else { } else {
while (written < width) { while (written < width) {
written += print_max(L" ", 0, 1, false, &line_data); written += print_max(L" ", 0, 1, false, &line_data);
@ -504,7 +504,6 @@ bool pager_t::completion_try_print(size_t cols, const wcstring &prefix, const co
// We limit the width to term_width - 1. // We limit the width to term_width - 1.
int search_field_written = print_max(SEARCH_FIELD_PROMPT, highlight_spec_normal, int search_field_written = print_max(SEARCH_FIELD_PROMPT, highlight_spec_normal,
term_width - 1, false, search_field); term_width - 1, false, search_field);
search_field_written +=
print_max(search_field_text, highlight_modifier_force_underline, print_max(search_field_text, highlight_modifier_force_underline,
term_width - search_field_written - 1, false, search_field); term_width - search_field_written - 1, false, search_field);
} }
@ -611,7 +610,7 @@ bool pager_t::select_next_completion_in_direction(selection_direction_t directio
} }
// Ok, we had something selected already. Select something different. // Ok, we had something selected already. Select something different.
size_t new_selected_completion_idx = selected_completion_idx; size_t new_selected_completion_idx;
if (!selection_direction_is_cardinal(direction)) { if (!selection_direction_is_cardinal(direction)) {
// Next, previous, or deselect, all easy. // Next, previous, or deselect, all easy.
if (direction == direction_deselect) { if (direction == direction_deselect) {

View File

@ -1042,7 +1042,7 @@ void parse_ll_t::accept_tokens(parse_token_t token1, parse_token_t token2) {
if (logit) { if (logit) {
fprintf(stderr, "Consumed token %ls\n", token1.describe().c_str()); fprintf(stderr, "Consumed token %ls\n", token1.describe().c_str());
} }
consumed = true; // consumed = true;
break; break;
} }

View File

@ -2176,6 +2176,7 @@ static int threaded_highlight(background_highlight_context_t *ctx) {
/// an asynchronous highlight in the background, which may perform disk I/O. /// an asynchronous highlight in the background, which may perform disk I/O.
static void reader_super_highlight_me_plenty(int match_highlight_pos_adjust, bool no_io) { static void reader_super_highlight_me_plenty(int match_highlight_pos_adjust, bool no_io) {
const editable_line_t *el = &data->command_line; const editable_line_t *el = &data->command_line;
assert (el != NULL);
long match_highlight_pos = (long)el->position + match_highlight_pos_adjust; long match_highlight_pos = (long)el->position + match_highlight_pos_adjust;
assert(match_highlight_pos >= 0); assert(match_highlight_pos >= 0);

View File

@ -252,7 +252,7 @@ size_t escape_code_length(const wchar_t *code) {
if (!found) found = is_iterm2_escape_seq(code, &resulting_length); if (!found) found = is_iterm2_escape_seq(code, &resulting_length);
if (!found) found = is_single_byte_escape_seq(code, &resulting_length); if (!found) found = is_single_byte_escape_seq(code, &resulting_length);
if (!found) found = is_csi_style_escape_seq(code, &resulting_length); if (!found) found = is_csi_style_escape_seq(code, &resulting_length);
if (!found) found = is_two_byte_escape_seq(code, &resulting_length); if (!found) is_two_byte_escape_seq(code, &resulting_length);
return resulting_length; return resulting_length;
} }