vim-patch:7.4.2062 (#5954)

Problem:    Using dummy variable to compute struct member offset.
Solution:   Use offsetof().

840268400d
This commit is contained in:
Shougo 2017-01-17 07:18:19 +09:00 committed by Justin M. Keyes
parent 340f79b4b8
commit a062cd4ce5
2 changed files with 6 additions and 4 deletions

View File

@ -292,6 +292,9 @@
#include <stdlib.h>
#include <wctype.h>
/* for offsetof() */
#include <stddef.h>
#include "nvim/vim.h"
#include "nvim/ascii.h"
#include "nvim/spell.h"
@ -583,9 +586,8 @@ 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 HI2WC(hi) ((wordcount_T *)((hi)->hi_key - WC_KEY_OFF))
#define WC_KEY_OFF offsetof(wordcount_T, wc_word)
#define HI2WC(hi) ((wordcount_T *)((hi)->hi_key - WC_KEY_OFF))
#define MAXWORDCOUNT 0xffff
// Information used when looking for suggestions.

View File

@ -378,7 +378,7 @@ static int included_patches[] = {
2065,
// 2064,
// 2063 NA
// 2062,
2062,
// 2061,
// 2060 NA
// 2059 NA