aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/syntax.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2014-08-08 09:27:09 -0400
committerJustin M. Keyes <justinkz@gmail.com>2014-08-08 09:27:09 -0400
commit19f44fda8bc74abdcd13deca47be99b151f69239 (patch)
treef79a83af7a9b44f89b26cc3fe7a37a87ca20d28b /src/nvim/syntax.c
parent54d49931255090ebf33c342aed6fbe9f9ca308e6 (diff)
parentbdd82b0da729b77381219927eb174b8e4d2054f8 (diff)
downloadrneovim-19f44fda8bc74abdcd13deca47be99b151f69239.tar.gz
rneovim-19f44fda8bc74abdcd13deca47be99b151f69239.tar.bz2
rneovim-19f44fda8bc74abdcd13deca47be99b151f69239.zip
Merge pull request #985 from fwalch/clang-analyzer-dead-assignments
Clang analyzer: fix dead stores / reduce scope
Diffstat (limited to 'src/nvim/syntax.c')
-rw-r--r--src/nvim/syntax.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 7dd3453d16..5b9deb184a 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -5684,22 +5684,19 @@ static int syn_compare_syntime(const void *v1, const void *v2)
*/
static void syntime_report(void)
{
- synpat_T *spp;
- proftime_T tm;
- int len;
- int total_count = 0;
- garray_T ga;
- time_entry_T *p;
-
if (!syntax_present(curwin)) {
MSG(_(msg_no_items));
return;
}
+ garray_T ga;
ga_init(&ga, sizeof(time_entry_T), 50);
+
proftime_T total_total = profile_zero();
+ int total_count = 0;
+ time_entry_T *p;
for (int idx = 0; idx < curwin->w_s->b_syn_patterns.ga_len; ++idx) {
- spp = &(SYN_ITEMS(curwin->w_s)[idx]);
+ synpat_T *spp = &(SYN_ITEMS(curwin->w_s)[idx]);
if (spp->sp_time.count > 0) {
p = GA_APPEND_VIA_PTR(time_entry_T, &ga);
p->total = spp->sp_time.total;
@@ -5708,7 +5705,7 @@ static void syntime_report(void)
p->match = spp->sp_time.match;
total_count += spp->sp_time.count;
p->slowest = spp->sp_time.slowest;
- tm = profile_divide(spp->sp_time.total, spp->sp_time.count);
+ proftime_T tm = profile_divide(spp->sp_time.total, spp->sp_time.count);
p->average = tm;
p->id = spp->sp_syn.id;
p->pattern = spp->sp_pattern;
@@ -5723,7 +5720,6 @@ static void syntime_report(void)
" TOTAL COUNT MATCH SLOWEST AVERAGE NAME PATTERN"));
MSG_PUTS("\n");
for (int idx = 0; idx < ga.ga_len && !got_int; ++idx) {
- spp = &(SYN_ITEMS(curwin->w_s)[idx]);
p = ((time_entry_T *)ga.ga_data) + idx;
MSG_PUTS(profile_msg(p->total));
@@ -5745,6 +5741,7 @@ static void syntime_report(void)
MSG_PUTS(" ");
msg_advance(69);
+ int len;
if (Columns < 80)
len = 20; /* will wrap anyway */
else