{
struct collected_reflog *e;
struct collect_reflog_cb *cb = cb_data;
- size_t namelen = strlen(ref);
- e = xmalloc(sizeof(*e) + namelen + 1);
+ FLEX_ALLOC_STR(e, reflog, ref);
hashcpy(e->sha1, oid->hash);
- memcpy(e->reflog, ref, namelen + 1);
ALLOC_GROW(cb->e, cb->nr + 1, cb->alloc);
cb->e[cb->nr++] = e;
return 0;
ent->pattern[len] == '\0')
return ent;
- ent = xcalloc(1, sizeof(*ent) + len + 1);
- memcpy(ent->pattern, pattern, len);
+ FLEX_ALLOC_MEM(ent, pattern, pattern, len);
*reflog_expire_cfg_tail = ent;
reflog_expire_cfg_tail = &(ent->next);
return ent;