Mercurial > vim
comparison src/structs.h @ 15247:336728a577f5 v8.1.0632
patch 8.1.0632: using sign group names is inefficient
commit https://github.com/vim/vim/commit/7a2d9892b7158edf8dc48e9bcaaae70a40787b37
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Dec 24 20:23:49 2018 +0100
patch 8.1.0632: using sign group names is inefficient
Problem: Using sign group names is inefficient.
Solution: Store group names in a hash table and use a reference to them.
Also remove unnecessary use of ":exe" from the tests. (Yegappan
Lakshmanan, closes #3715)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 24 Dec 2018 20:30:04 +0100 |
parents | 83ff85896a14 |
children | 19e79a1ed6b6 |
comparison
equal
deleted
inserted
replaced
15246:a6fc4675cf61 | 15247:336728a577f5 |
---|---|
731 #define PT_FLAG_INS_START_INCL 1 // insert at start included in property | 731 #define PT_FLAG_INS_START_INCL 1 // insert at start included in property |
732 #define PT_FLAG_INS_END_INCL 2 // insert at end included in property | 732 #define PT_FLAG_INS_END_INCL 2 // insert at end included in property |
733 | 733 |
734 | 734 |
735 #if defined(FEAT_SIGNS) || defined(PROTO) | 735 #if defined(FEAT_SIGNS) || defined(PROTO) |
736 // Sign group | |
737 typedef struct signgroup_S | |
738 { | |
739 short_u refcount; // number of signs in this group | |
740 char_u sg_name[1]; // sign group name | |
741 } signgroup_T; | |
742 | |
743 // Macros to get the sign group structure from the group name | |
744 #define SGN_KEY_OFF offsetof(signgroup_T, sg_name) | |
745 #define HI2SG(hi) ((signgroup_T *)((hi)->hi_key - SGN_KEY_OFF)) | |
746 | |
736 typedef struct signlist signlist_T; | 747 typedef struct signlist signlist_T; |
737 | 748 |
738 struct signlist | 749 struct signlist |
739 { | 750 { |
740 int id; /* unique identifier for each placed sign */ | 751 int id; /* unique identifier for each placed sign */ |
741 linenr_T lnum; /* line number which has this sign */ | 752 linenr_T lnum; /* line number which has this sign */ |
742 int typenr; /* typenr of sign */ | 753 int typenr; /* typenr of sign */ |
743 char_u *group; /* sign group */ | 754 signgroup_T *group; /* sign group */ |
744 int priority; /* priority for highlighting */ | 755 int priority; /* priority for highlighting */ |
745 signlist_T *next; /* next signlist entry */ | 756 signlist_T *next; /* next signlist entry */ |
746 signlist_T *prev; /* previous entry -- for easy reordering */ | 757 signlist_T *prev; /* previous entry -- for easy reordering */ |
747 }; | 758 }; |
748 | 759 |