From 5afedb64aa6494fa5436373889fc2bf2fe30604d Mon Sep 17 00:00:00 2001 From: obarun <eric@obarun.org> Date: Mon, 23 Mar 2020 08:30:03 +1100 Subject: [PATCH] remove useless allocation --- src/lib66/instance.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib66/instance.c b/src/lib66/instance.c index c246ed5a..5ae5f6ec 100644 --- a/src/lib66/instance.c +++ b/src/lib66/instance.c @@ -53,11 +53,15 @@ int instance_splitname(stralloc *sa,char const *name,int len,int what) sa->len = 0 ; if (!what) + { if (!stralloc_cats(sa,template) || !stralloc_0(sa)) return 0 ; + } else + { if (!stralloc_catb(sa,copy,strlen(copy)) || !stralloc_0(sa)) return 0 ; + } return 1 ; } @@ -68,10 +72,6 @@ int instance_create(stralloc *sasv,char const *svname, char const *regex, int le stralloc tmp = STRALLOC_ZERO ; - char template[tlen + 1] ; - memcpy(template,svname,tlen) ; - template[tlen] = 0 ; - if (!auto_stra(&tmp,sasv->s)) goto err ; copy = svname + tlen ; -- GitLab