credential-cache--daemon.c: use warning_errno()
[gitweb.git] / log-tree.c
index f70a30e12702fa68c77f6b2490692f3861ad32e7..60f983934d5ea2c8e276d2c493d78caf56e9a39a 100644 (file)
@@ -77,9 +77,8 @@ int parse_decorate_color_config(const char *var, const char *slot_name, const ch
 
 void add_name_decoration(enum decoration_type type, const char *name, struct object *obj)
 {
-       int nlen = strlen(name);
-       struct name_decoration *res = xmalloc(sizeof(*res) + nlen + 1);
-       memcpy(res->name, name, nlen + 1);
+       struct name_decoration *res;
+       FLEX_ALLOC_STR(res, name, name);
        res->type = type;
        res->next = add_decoration(&name_decoration, obj, res);
 }