1
0
forked from aniani/vim

patch 7.4.2062

Problem:    Using dummy variable to compute struct member offset.
Solution:   Use offsetof().
This commit is contained in:
Bram Moolenaar
2016-07-17 20:37:43 +02:00
parent e87e6dddc2
commit 840268400d
5 changed files with 17 additions and 14 deletions

View File

@@ -600,8 +600,7 @@ typedef struct wordcount_S
char_u wc_word[1]; /* word, actually longer */
} wordcount_T;
static wordcount_T dumwc;
#define WC_KEY_OFF (unsigned)(dumwc.wc_word - (char_u *)&dumwc)
#define WC_KEY_OFF offsetof(wordcount_T, wc_word)
#define HI2WC(hi) ((wordcount_T *)((hi)->hi_key - WC_KEY_OFF))
#define MAXWORDCOUNT 0xffff