Ken Takata wrote:

> Hi Bram,
> 
> 2016/7/17 Sun 21:57:30 UTC+9 Bram Moolenaar wrote:
> > Patch 7.4.2055
> > Problem:    eval.c is too big.
> > Solution:   Move Dictionary functions to dict.c.
> > Files:      src/eval.c, src/dict.c, src/vim.h, src/globals.h,
> >             src/proto/eval.pro, src/proto/dict.pro, src/Makefile, Filelist
> 
> > + EXTERN dictitem_T dumdi;
> > + # define DI2HIKEY(di) ((di)->di_key)
> > + # define HIKEY2DI(p)  ((dictitem_T *)(p - (dumdi.di_key - (char_u 
> > *)&dumdi)))
> 
> A dummy variable is used in this part in globals.h, but actually it is
> unnecessary:
> 
> # define DI2HIKEY(di) ((di)->di_key)
> # define HIKEY2DI(p)  ((dictitem_T *)(p - (size_t)&(((dictitem_T 
> *)NULL)->di_key)))
> 
> 
> Or we can use offsetof() macro defined in stddef.h:
> 
> # include <stddef.h>
> # define DI2HIKEY(di) ((di)->di_key)
> # define HIKEY2DI(p)  ((dictitem_T *)(p - offsetof(dictitem_T, di_key)))

I suppose now that we require ANSI C we can use offsetof().

I thought this was used in other places, but now I can't find any.
Oh, there is one in spell.c.

-- 
Veni, Vidi, Video -- I came, I saw, I taped what I saw.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui