diff options
author | Jindrich Novy <jnovy@redhat.com> | 2008-04-29 14:59:18 +0200 |
---|---|---|
committer | Jindrich Novy <jnovy@redhat.com> | 2008-04-29 14:59:18 +0200 |
commit | 498677dad2abb860ca6acd5aaa7aa0ef6d288267 (patch) | |
tree | da1446cb53ec357a0101f523240c6148c978b037 /lib/fsm.c | |
parent | bd9e4ed8d7dec6ab7a247298fa8ce5be67e98f58 (diff) | |
download | rpm-498677dad2abb860ca6acd5aaa7aa0ef6d288267.tar.gz rpm-498677dad2abb860ca6acd5aaa7aa0ef6d288267.tar.bz2 rpm-498677dad2abb860ca6acd5aaa7aa0ef6d288267.zip |
Remove useless alloca_strdup()
- and yet more alloca usage in writeFile()
Diffstat (limited to 'lib/fsm.c')
-rw-r--r-- | lib/fsm.c | 18 |
1 files changed, 7 insertions, 11 deletions
@@ -19,8 +19,6 @@ #include "debug.h" -#define alloca_strdup(_s) strcpy(alloca(strlen(_s)+1), (_s)) - #define _FSM_DEBUG 0 int _fsm_debug = _FSM_DEBUG; @@ -825,24 +823,21 @@ static int writeFile(FSM_t fsm, int writeData) rc = fsmUNSAFE(fsm, FSM_READLINK); if (rc) goto exit; st->st_size = fsm->rdnb; - symbuf = alloca_strdup(fsm->rdbuf); /* XXX save readlink return. */ + rstrcat(&symbuf, fsm->rdbuf); /* XXX save readlink return. */ } if (fsm->mapFlags & CPIO_MAP_ABSOLUTE) { - int nb = strlen(fsm->dirName) + strlen(fsm->baseName) + sizeof("."); - char * t = alloca(nb); - *t = '\0'; - fsm->path = t; + fsm->path = NULL; if (fsm->mapFlags & CPIO_MAP_ADDDOT) - *t++ = '.'; - t = stpcpy( stpcpy(t, fsm->dirName), fsm->baseName); + rstrcat(&fsm->path, "."); + rstrscat(&fsm->path, fsm->dirName, fsm->baseName, NULL); } else if (fsm->mapFlags & CPIO_MAP_PATH) { rpmfi fi = fsmGetFi(fsm); - fsm->path = - (fi->apath ? fi->apath[fsm->ix] + fi->striplen : fi->bnl[fsm->ix]); + fsm->path = xstrdup((fi->apath ? fi->apath[fsm->ix] + fi->striplen : fi->bnl[fsm->ix])); } rc = fsmNext(fsm, FSM_HWRITE); + free(fsm->path); fsm->path = path; if (rc) goto exit; @@ -920,6 +915,7 @@ exit: (void) fsmNext(fsm, FSM_RCLOSE); fsm->opath = opath; fsm->path = path; + free(symbuf); return rc; } |