File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1649,18 +1649,6 @@ EXTERN int did_add_timer INIT(= FALSE);
16491649#ifdef FEAT_EVAL
16501650EXTERN time_T time_for_testing INIT (= 0 );
16511651
1652- /*
1653- * In a hashtab item "hi_key" points to "di_key" in a dictitem.
1654- * This avoids adding a pointer to the hashtab item.
1655- * DI2HIKEY() converts a dictitem pointer to a hashitem key pointer.
1656- * HIKEY2DI() converts a hashitem key pointer to a dictitem pointer.
1657- * HI2DI() converts a hashitem pointer to a dictitem pointer.
1658- */
1659- EXTERN dictitem_T dumdi ;
1660- # define DI2HIKEY (di ) ((di)->di_key)
1661- # define HIKEY2DI (p ) ((dictitem_T *)(p - (dumdi.di_key - (char_u *)&dumdi)))
1662- # define HI2DI (hi ) HIKEY2DI((hi)->hi_key)
1663-
16641652/* Abort conversion to string after a recursion error. */
16651653EXTERN int did_echo_string_emsg INIT (= FALSE);
16661654#endif
Original file line number Diff line number Diff line change 353353# endif
354354# endif
355355#endif
356+
357+ /*
358+ * In a hashtab item "hi_key" points to "di_key" in a dictitem.
359+ * This avoids adding a pointer to the hashtab item.
360+ * DI2HIKEY() converts a dictitem pointer to a hashitem key pointer.
361+ * HIKEY2DI() converts a hashitem key pointer to a dictitem pointer.
362+ * HI2DI() converts a hashitem pointer to a dictitem pointer.
363+ */
364+ # define DI2HIKEY (di ) ((di)->di_key)
365+ # define HIKEY2DI (p ) ((dictitem_T *)(p - offsetof(dictitem_T, di_key)))
366+ # define HI2DI (hi ) HIKEY2DI((hi)->hi_key)
Original file line number Diff line number Diff line change @@ -600,8 +600,7 @@ typedef struct wordcount_S
600600 char_u wc_word [1 ]; /* word, actually longer */
601601} wordcount_T ;
602602
603- static wordcount_T dumwc ;
604- #define WC_KEY_OFF (unsigned)(dumwc.wc_word - (char_u *)&dumwc)
603+ #define WC_KEY_OFF offsetof(wordcount_T, wc_word)
605604#define HI2WC (hi ) ((wordcount_T *)((hi)->hi_key - WC_KEY_OFF))
606605#define MAXWORDCOUNT 0xffff
607606
Original file line number Diff line number Diff line change @@ -758,6 +758,8 @@ static char *(features[]) =
758758
759759static int included_patches [] =
760760{ /* Add new patch number below this line */
761+ /**/
762+ 2062 ,
761763/**/
762764 2061 ,
763765/**/
Original file line number Diff line number Diff line change @@ -505,6 +505,9 @@ typedef unsigned long u8char_T; /* long should be 32 bits or more */
505505#endif
506506#include <stdarg.h>
507507
508+ /* for offsetof() */
509+ #include <stddef.h>
510+
508511#if defined(HAVE_SYS_SELECT_H ) && \
509512 (!defined(HAVE_SYS_TIME_H ) || defined(SYS_SELECT_WITH_SYS_TIME ))
510513# include <sys/select.h>
You can’t perform that action at this time.
0 commit comments