unittest: Add dict_items function

This commit is contained in:
ZyX
2017-01-07 15:26:34 +03:00
parent a970c1a957
commit 728367a196
5 changed files with 45 additions and 13 deletions

View File

@@ -6445,7 +6445,7 @@ void dict_free(dict_T *d) {
*/
dictitem_T *dictitem_alloc(char_u *key) FUNC_ATTR_NONNULL_RET
{
dictitem_T *di = xmalloc(sizeof(dictitem_T) + STRLEN(key));
dictitem_T *di = xmalloc(offsetof(dictitem_T, di_key) + STRLEN(key) + 1);
#ifndef __clang_analyzer__
STRCPY(di->di_key, key);
#endif