summaryrefslogtreecommitdiffstats
path: root/src/structs.h
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-12-24 20:23:49 +0100
committerBram Moolenaar <Bram@vim.org>2018-12-24 20:23:49 +0100
commit7a2d9892b7158edf8dc48e9bcaaae70a40787b37 (patch)
treee448e08f0ac96c806d96209f9c1bd415101e5175 /src/structs.h
parentd6024e2dd4e0c1556d9b69e61c4059fa78e5609d (diff)
patch 8.1.0632: using sign group names is inefficientv8.1.0632
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)
Diffstat (limited to 'src/structs.h')
-rw-r--r--src/structs.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/structs.h b/src/structs.h
index 0f37b8f66b..e4311eda41 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -733,6 +733,17 @@ typedef struct proptype_S
#if defined(FEAT_SIGNS) || defined(PROTO)
+// Sign group
+typedef struct signgroup_S
+{
+ short_u refcount; // number of signs in this group
+ char_u sg_name[1]; // sign group name
+} signgroup_T;
+
+// Macros to get the sign group structure from the group name
+#define SGN_KEY_OFF offsetof(signgroup_T, sg_name)
+#define HI2SG(hi) ((signgroup_T *)((hi)->hi_key - SGN_KEY_OFF))
+
typedef struct signlist signlist_T;
struct signlist
@@ -740,7 +751,7 @@ struct signlist
int id; /* unique identifier for each placed sign */
linenr_T lnum; /* line number which has this sign */
int typenr; /* typenr of sign */
- char_u *group; /* sign group */
+ signgroup_T *group; /* sign group */
int priority; /* priority for highlighting */
signlist_T *next; /* next signlist entry */
signlist_T *prev; /* previous entry -- for easy reordering */