diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2010-10-28 11:01:39 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2010-10-28 11:10:38 +0300 |
commit | 4100680ec20bce51e50e0d87203d5386c736f31c (patch) | |
tree | b09bdddd0fa224f5709ed133c2989d018de1fde7 /build/parsePrep.c | |
parent | 3b99c79ef92fbf63f6b9ede762b7cdff169086d6 (diff) | |
download | rpm-4100680ec20bce51e50e0d87203d5386c736f31c.tar.gz rpm-4100680ec20bce51e50e0d87203d5386c736f31c.tar.bz2 rpm-4100680ec20bce51e50e0d87203d5386c736f31c.zip |
Use ARGV_t for temporary line storage directly
- Similar to commit 1e3db59b568b1ff7f7e1f3285fc9b18567f2f2d6,
no point using temporary string buffer when only end up splitting
it into an argv for processing. Incidently this would've been
a much less intrusive fix to RhBug:573339 than introducing
a whole new argvSplitString() function... oh well. Take care not
to introduce extra newlines in the process as argvSplitString() was
eating them before - need to use appendStringBuf() for spec->prep now.
Diffstat (limited to 'build/parsePrep.c')
-rw-r--r-- | build/parsePrep.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/build/parsePrep.c b/build/parsePrep.c index 7e9105628..af31acd93 100644 --- a/build/parsePrep.c +++ b/build/parsePrep.c @@ -489,8 +489,6 @@ exit: int parsePrep(rpmSpec spec) { int nextPart, res, rc; - StringBuf sb; - char **lines; ARGV_t saveLines = NULL; if (spec->prep != NULL) { @@ -507,12 +505,10 @@ int parsePrep(rpmSpec spec) return PART_ERROR; } - sb = newStringBuf(); - while (! (nextPart = isPart(spec->line))) { /* Need to expand the macros inline. That way we */ /* can give good line number information on error. */ - appendStringBuf(sb, spec->line); + argvAdd(&saveLines, spec->line); if ((rc = readLine(spec, STRIP_NOTHING)) > 0) { nextPart = PART_NONE; break; @@ -521,15 +517,14 @@ int parsePrep(rpmSpec spec) } } - saveLines = argvSplitString(getStringBuf(sb), "\n", ARGV_NONE); - for (lines = saveLines; *lines; lines++) { + for (ARGV_const_t lines = saveLines; *lines; lines++) { res = 0; if (rstreqn(*lines, "%setup", sizeof("%setup")-1)) { res = doSetupMacro(spec, *lines); } else if (rstreqn(*lines, "%patch", sizeof("%patch")-1)) { res = doPatchMacro(spec, *lines); } else { - appendLineStringBuf(spec->prep, *lines); + appendStringBuf(spec->prep, *lines); } if (res && !(spec->flags & RPMSPEC_FORCE)) { /* fixup from RPMRC_FAIL do*Macro() codes for now */ @@ -541,7 +536,6 @@ int parsePrep(rpmSpec spec) exit: argvFree(saveLines); - sb = freeStringBuf(sb); return nextPart; } |