diff options
author | Florian Walch <florian@fwalch.com> | 2014-07-23 11:57:56 +0200 |
---|---|---|
committer | Florian Walch <florian@fwalch.com> | 2014-08-07 15:19:59 +0200 |
commit | 4fa8a0c43c7ed88e39936baaa40e8d019d3a9f5e (patch) | |
tree | 2e668de875da61c926260c20b8ac2f46165cab0c /src | |
parent | 020bfb6ea201c1aac2533f5c4344ceb1b48839db (diff) | |
download | rneovim-4fa8a0c43c7ed88e39936baaa40e8d019d3a9f5e.tar.gz rneovim-4fa8a0c43c7ed88e39936baaa40e8d019d3a9f5e.tar.bz2 rneovim-4fa8a0c43c7ed88e39936baaa40e8d019d3a9f5e.zip |
clang-analyzer: Reduce scope in syntax.c.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/syntax.c | 17 |
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 |