summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-10-28 10:51:00 +0300
committerPanu Matilainen <pmatilai@redhat.com>2010-10-28 10:51:00 +0300
commit3b99c79ef92fbf63f6b9ede762b7cdff169086d6 (patch)
treeb19ac491424b31cde12d54b01b6b3c2cd5dd656f
parent3f152a1312d10a90249169f6b978d96b84e5991b (diff)
downloadrpm-3b99c79ef92fbf63f6b9ede762b7cdff169086d6.tar.gz
rpm-3b99c79ef92fbf63f6b9ede762b7cdff169086d6.tar.bz2
rpm-3b99c79ef92fbf63f6b9ede762b7cdff169086d6.zip
Pass the script to doScript() as const char *
- doScript() doesn't do anything special with the script buffer, this lets us use const for the argument.
-rw-r--r--build/build.c20
-rw-r--r--build/files.c3
-rw-r--r--build/rpmbuild_internal.h2
3 files changed, 16 insertions, 9 deletions
diff --git a/build/build.c b/build/build.c
index 9ba5f8f47..443cf94d6 100644
--- a/build/build.c
+++ b/build/build.c
@@ -49,7 +49,8 @@ exit:
/*
* @todo Single use by %%doc in files.c prevents static.
*/
-rpmRC doScript(rpmSpec spec, rpmBuildFlags what, const char *name, StringBuf sb, int test)
+rpmRC doScript(rpmSpec spec, rpmBuildFlags what, const char *name,
+ const char *sb, int test)
{
const char * rootDir = spec->rootDir;
char *scriptName = NULL;
@@ -146,7 +147,7 @@ rpmRC doScript(rpmSpec spec, rpmBuildFlags what, const char *name, StringBuf sb,
if (spec->buildSubdir)
fprintf(fp, "rm -rf '%s'\n", spec->buildSubdir);
} else if (sb != NULL)
- fprintf(fp, "%s", getStringBuf(sb));
+ fprintf(fp, "%s", sb);
(void) fputs(buildPost, fp);
@@ -225,19 +226,23 @@ static rpmRC buildSpec(BTA_t buildArgs, rpmSpec spec, int what)
int didBuild = (what & (RPMBUILD_PREP|RPMBUILD_BUILD|RPMBUILD_INSTALL));
if ((what & RPMBUILD_PREP) &&
- (rc = doScript(spec, RPMBUILD_PREP, "%prep", spec->prep, test)))
+ (rc = doScript(spec, RPMBUILD_PREP, "%prep",
+ getStringBuf(spec->prep), test)))
goto exit;
if ((what & RPMBUILD_BUILD) &&
- (rc = doScript(spec, RPMBUILD_BUILD, "%build", spec->build, test)))
+ (rc = doScript(spec, RPMBUILD_BUILD, "%build",
+ getStringBuf(spec->build), test)))
goto exit;
if ((what & RPMBUILD_INSTALL) &&
- (rc = doScript(spec, RPMBUILD_INSTALL, "%install", spec->install, test)))
+ (rc = doScript(spec, RPMBUILD_INSTALL, "%install",
+ getStringBuf(spec->install), test)))
goto exit;
if ((what & RPMBUILD_CHECK) &&
- (rc = doScript(spec, RPMBUILD_CHECK, "%check", spec->check, test)))
+ (rc = doScript(spec, RPMBUILD_CHECK, "%check",
+ getStringBuf(spec->check), test)))
goto exit;
if ((what & RPMBUILD_PACKAGESOURCE) &&
@@ -263,7 +268,8 @@ static rpmRC buildSpec(BTA_t buildArgs, rpmSpec spec, int what)
goto exit;
if ((what & RPMBUILD_CLEAN) &&
- (rc = doScript(spec, RPMBUILD_CLEAN, "%clean", spec->clean, test)))
+ (rc = doScript(spec, RPMBUILD_CLEAN, "%clean",
+ getStringBuf(spec->clean), test)))
goto exit;
if ((what & RPMBUILD_RMBUILD) &&
diff --git a/build/files.c b/build/files.c
index 2692be039..d5689e4c9 100644
--- a/build/files.c
+++ b/build/files.c
@@ -1867,7 +1867,8 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags,
rpmExpandNumeric("%{?_missing_doc_files_terminate_build}");
rpmRC rc;
- rc = doScript(spec, RPMBUILD_STRINGBUF, "%doc", pkg->specialDoc, test);
+ rc = doScript(spec, RPMBUILD_STRINGBUF, "%doc",
+ getStringBuf(pkg->specialDoc), test);
if (rc != RPMRC_OK && _missing_doc_files_terminate_build)
fl.processingFailed = 1;
}
diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h
index f91569942..3df9f0602 100644
--- a/build/rpmbuild_internal.h
+++ b/build/rpmbuild_internal.h
@@ -335,7 +335,7 @@ int parseExpressionBoolean(rpmSpec spec, const char * expr);
*/
RPM_GNUC_INTERNAL
rpmRC doScript(rpmSpec spec, rpmBuildFlags what, const char * name,
- StringBuf sb, int test);
+ const char * sb, int test);
/** \ingroup rpmbuild
* Find sub-package control structure by name.