summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/getchar.c2
-rw-r--r--src/regexp.c2
-rw-r--r--src/sign.c2
-rw-r--r--src/structs.h4
-rw-r--r--src/syntax.c2
-rw-r--r--src/textprop.c2
-rw-r--r--src/userfunc.c4
-rw-r--r--src/version.c2
8 files changed, 11 insertions, 9 deletions
diff --git a/src/getchar.c b/src/getchar.c
index 4a3587c3f..b0e72f58f 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -232,7 +232,7 @@ add_buff(
len = MINIMAL_SIZE;
else
len = slen;
- p = alloc(sizeof(buffblock_T) + len);
+ p = alloc(offsetof(buffblock_T, b_str) + len + 1);
if (p == NULL)
return; /* no space, just forget it */
buf->bh_space = (int)(len - slen);
diff --git a/src/regexp.c b/src/regexp.c
index c95795d0c..dd99607f4 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -1319,7 +1319,7 @@ bt_regcomp(char_u *expr, int re_flags)
return NULL;
/* Allocate space. */
- r = alloc(sizeof(bt_regprog_T) + regsize);
+ r = alloc(offsetof(bt_regprog_T, program) + regsize);
if (r == NULL)
return NULL;
r->re_in_use = FALSE;
diff --git a/src/sign.c b/src/sign.c
index 2cec269f9..9a7ca21ba 100644
--- a/src/sign.c
+++ b/src/sign.c
@@ -85,7 +85,7 @@ sign_group_ref(char_u *groupname)
if (HASHITEM_EMPTY(hi))
{
// new group
- group = alloc(sizeof(signgroup_T) + STRLEN(groupname));
+ group = alloc(offsetof(signgroup_T, sg_name) + STRLEN(groupname) + 1);
if (group == NULL)
return NULL;
STRCPY(group->sg_name, groupname);
diff --git a/src/structs.h b/src/structs.h
index c34bbeb7b..0aedbbd2c 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -742,9 +742,9 @@ typedef struct proptype_S
// Sign group
typedef struct signgroup_S
{
- short_u refcount; // number of signs in this group
int next_sign_id; // next sign id for this group
- char_u sg_name[1]; // sign group name
+ short_u refcount; // number of signs in this group
+ char_u sg_name[1]; // sign group name, actually longer
} signgroup_T;
typedef struct signlist signlist_T;
diff --git a/src/syntax.c b/src/syntax.c
index ad2e1a0cc..3d06f44f7 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -4394,7 +4394,7 @@ add_keyword(
name_folded, MAXKEYWLEN + 1);
else
name_ic = name;
- kp = alloc(sizeof(keyentry_T) + STRLEN(name_ic));
+ kp = alloc(offsetof(keyentry_T, keyword) + STRLEN(name_ic) + 1);
if (kp == NULL)
return;
STRCPY(kp->keyword, name_ic);
diff --git a/src/textprop.c b/src/textprop.c
index f219b925f..a97641429 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -695,7 +695,7 @@ prop_type_set(typval_T *argvars, int add)
semsg(_("E969: Property type %s already defined"), name);
return;
}
- prop = alloc_clear(sizeof(proptype_T) + STRLEN(name));
+ prop = alloc_clear(offsetof(proptype_T, pt_name) + STRLEN(name) + 1);
if (prop == NULL)
return;
STRCPY(prop->pt_name, name);
diff --git a/src/userfunc.c b/src/userfunc.c
index a739a757b..2bdc2b1cd 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -288,7 +288,7 @@ get_lambda_tv(char_u **arg, typval_T *rettv, int evaluate)
sprintf((char*)name, "<lambda>%d", ++lambda_no);
- fp = alloc_clear(sizeof(ufunc_T) + STRLEN(name));
+ fp = alloc_clear(offsetof(ufunc_T, uf_name) + STRLEN(name) + 1);
if (fp == NULL)
goto errret;
pt = ALLOC_CLEAR_ONE(partial_T);
@@ -2631,7 +2631,7 @@ ex_function(exarg_T *eap)
}
}
- fp = alloc_clear(sizeof(ufunc_T) + STRLEN(name));
+ fp = alloc_clear(offsetof(ufunc_T, uf_name) + STRLEN(name) + 1);
if (fp == NULL)
goto erret;
diff --git a/src/version.c b/src/version.c
index 93b8a2dcc..4f8f152cd 100644
--- a/src/version.c
+++ b/src/version.c
@@ -770,6 +770,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1827,
+/**/
1826,
/**/
1825,