diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-07-31 11:52:51 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-07-31 11:56:01 +0300 |
commit | 729fd554ee99413c0f106b8d243dc2329fe4dff6 (patch) | |
tree | 9fa06d44780ae070bc2a99c28a2237920b995f6c /build | |
parent | 0c737f72b244d7ecb4a5c8109f081d3e28c736aa (diff) | |
download | rpm-729fd554ee99413c0f106b8d243dc2329fe4dff6.tar.gz rpm-729fd554ee99413c0f106b8d243dc2329fe4dff6.tar.bz2 rpm-729fd554ee99413c0f106b8d243dc2329fe4dff6.zip |
Allocate spec line buffer separately from spec struct
- Further preliminaries for dynamic buffer resizing
Diffstat (limited to 'build')
-rw-r--r-- | build/parseSpec.c | 2 | ||||
-rw-r--r-- | build/rpmbuild_internal.h | 3 | ||||
-rw-r--r-- | build/spec.c | 3 |
3 files changed, 6 insertions, 2 deletions
diff --git a/build/parseSpec.c b/build/parseSpec.c index d2ee92235..4993fffe8 100644 --- a/build/parseSpec.c +++ b/build/parseSpec.c @@ -203,7 +203,7 @@ static int copyNextLineFromOFI(rpmSpec spec, OFI_t *ofi) /* Don't expand macros (eg. %define) in false branch of %if clause */ if (spec->readStack->reading && - expandMacros(spec, spec->macros, spec->lbuf, sizeof(spec->lbuf))) { + expandMacros(spec, spec->macros, spec->lbuf, spec->lbufSize)) { rpmlog(RPMLOG_ERR, _("line %d: %s\n"), spec->lineNum, spec->lbuf); return -1; diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h index 50ddbe3a9..96f00288a 100644 --- a/build/rpmbuild_internal.h +++ b/build/rpmbuild_internal.h @@ -41,7 +41,8 @@ struct rpmSpec_s { const char * rootDir; struct OpenFileInfo * fileStack; - char lbuf[10*BUFSIZ]; + char *lbuf; + size_t lbufSize; size_t lbufOff; char nextpeekc; char * nextline; diff --git a/build/spec.c b/build/spec.c index 00e4e6d3a..4b6b6805d 100644 --- a/build/spec.c +++ b/build/spec.c @@ -160,6 +160,8 @@ rpmSpec newSpec(void) spec->specFile = NULL; spec->fileStack = NULL; + spec->lbufSize = BUFSIZ * 10; + spec->lbuf = xmalloc(spec->lbufSize); spec->lbuf[0] = '\0'; spec->line = spec->lbuf; spec->nextline = NULL; @@ -237,6 +239,7 @@ rpmSpec rpmSpecFree(rpmSpec spec) rl->next = NULL; free(rl); } + spec->lbuf = _free(spec->lbuf); spec->sourceRpmName = _free(spec->sourceRpmName); spec->sourcePkgId = _free(spec->sourcePkgId); |