aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Aaron Gyes <me@aaron.gy>2016-06-14 19:21:50 -0700
committerGravatar Aaron Gyes <me@aaron.gy>2016-06-14 19:27:00 -0700
commit9f0c31611c189b7685cd5a818330ce36a9774eeb (patch)
treeef3d7e170b95e09cfdb279f5c3971654a07bef49
parentd70be18c4255829b3b6bc3d71b791740a9bba6ac (diff)
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.
-rw-r--r--src/common.cpp2
-rw-r--r--src/fish.cpp2
-rw-r--r--src/history.cpp2
-rw-r--r--src/pager.cpp11
-rw-r--r--src/parse_tree.cpp2
-rw-r--r--src/reader.cpp1
-rw-r--r--src/screen.cpp4
7 files changed, 11 insertions, 13 deletions
diff --git a/src/common.cpp b/src/common.cpp
index 49f53fb5..fcbb2465 100644
--- a/src/common.cpp
+++ b/src/common.cpp
@@ -749,7 +749,7 @@ wcstring reformat_for_screen(const wcstring &msg) {
// If token is zero character long, we don't do anything.
if (pos == start) {
- start = pos = pos + 1;
+ pos = pos + 1;
} else if (overflow) {
// In case of overflow, we print a newline, except if we already are at position 0.
wchar_t *token = wcsndup(start, pos - start);
diff --git a/src/fish.cpp b/src/fish.cpp
index 8a65d626..45899866 100644
--- a/src/fish.cpp
+++ b/src/fish.cpp
@@ -185,8 +185,6 @@ static struct config_paths_t determine_config_directory_paths(const char *argv0)
paths.sysconf = L"" SYSCONFDIR "/fish";
paths.doc = L"" DOCDIR;
paths.bin = L"" BINDIR;
-
- done = true;
}
return paths;
diff --git a/src/history.cpp b/src/history.cpp
index 49ed1b67..48469759 100644
--- a/src/history.cpp
+++ b/src/history.cpp
@@ -1387,7 +1387,7 @@ void history_t::save_internal(bool vacuum) {
}
if (!ok) {
// We did not or could not append; rewrite the file ("vacuum" it).
- ok = this->save_internal_via_rewrite();
+ this->save_internal_via_rewrite();
}
}
diff --git a/src/pager.cpp b/src/pager.cpp
index 1603ce8e..386bd664 100644
--- a/src/pager.cpp
+++ b/src/pager.cpp
@@ -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(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);
+ print_max(c->desc, packed_color, desc_width, false, &line_data);
+ print_max(L")", packed_color, 1, false, &line_data);
} else {
while (written < width) {
written += print_max(L" ", 0, 1, false, &line_data);
@@ -504,8 +504,7 @@ bool pager_t::completion_try_print(size_t cols, const wcstring &prefix, const co
// We limit the width to term_width - 1.
int search_field_written = print_max(SEARCH_FIELD_PROMPT, highlight_spec_normal,
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);
}
}
@@ -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.
- size_t new_selected_completion_idx = selected_completion_idx;
+ size_t new_selected_completion_idx;
if (!selection_direction_is_cardinal(direction)) {
// Next, previous, or deselect, all easy.
if (direction == direction_deselect) {
diff --git a/src/parse_tree.cpp b/src/parse_tree.cpp
index e5666f83..edfdc89c 100644
--- a/src/parse_tree.cpp
+++ b/src/parse_tree.cpp
@@ -1042,7 +1042,7 @@ void parse_ll_t::accept_tokens(parse_token_t token1, parse_token_t token2) {
if (logit) {
fprintf(stderr, "Consumed token %ls\n", token1.describe().c_str());
}
- consumed = true;
+ // consumed = true;
break;
}
diff --git a/src/reader.cpp b/src/reader.cpp
index be5457b0..3306255e 100644
--- a/src/reader.cpp
+++ b/src/reader.cpp
@@ -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.
static void reader_super_highlight_me_plenty(int match_highlight_pos_adjust, bool no_io) {
const editable_line_t *el = &data->command_line;
+ assert (el != NULL);
long match_highlight_pos = (long)el->position + match_highlight_pos_adjust;
assert(match_highlight_pos >= 0);
diff --git a/src/screen.cpp b/src/screen.cpp
index 54037d1a..fc5c927c 100644
--- a/src/screen.cpp
+++ b/src/screen.cpp
@@ -247,12 +247,12 @@ size_t escape_code_length(const wchar_t *code) {
}
}
}
-
+
if (!found) found = is_screen_name_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_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;
}