aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShougo <Shougo.Matsu@gmail.com>2017-01-17 07:18:19 +0900
committerJustin M. Keyes <justinkz@gmail.com>2017-01-16 23:18:19 +0100
commita062cd4ce58ba9aca6fdce443b014c9c0949ecde (patch)
tree530f5e8c2d775c21a67c95410add4d7c68489366
parent340f79b4b8f1021f4a3b88265ced2ce39d0e2e03 (diff)
downloadrneovim-a062cd4ce58ba9aca6fdce443b014c9c0949ecde.tar.gz
rneovim-a062cd4ce58ba9aca6fdce443b014c9c0949ecde.tar.bz2
rneovim-a062cd4ce58ba9aca6fdce443b014c9c0949ecde.zip
vim-patch:7.4.2062 (#5954)
Problem: Using dummy variable to compute struct member offset. Solution: Use offsetof(). https://github.com/vim/vim/commit/840268400dc8fda62a14f8a084e8b1ea46619454
-rw-r--r--src/nvim/spell.c8
-rw-r--r--src/nvim/version.c2
2 files changed, 6 insertions, 4 deletions
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 7119ac6dc1..7e0bbd6ad1 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -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.
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 93dd72f7fa..3dfc32fc6d 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -378,7 +378,7 @@ static int included_patches[] = {
2065,
// 2064,
// 2063 NA
- // 2062,
+ 2062,
// 2061,
// 2060 NA
// 2059 NA