diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-05-28 11:39:45 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-05-28 11:42:38 +0300 |
commit | 1adaff3ee47773172ab2e640414b1ada4dba8f9b (patch) | |
tree | 594079751e7eb9b545624152e608ab935b8fc652 /build | |
parent | d8334d2e3f8b96dd279cceba69bb9ca0d2ba7d8b (diff) | |
download | librpm-tizen-1adaff3ee47773172ab2e640414b1ada4dba8f9b.tar.gz librpm-tizen-1adaff3ee47773172ab2e640414b1ada4dba8f9b.tar.bz2 librpm-tizen-1adaff3ee47773172ab2e640414b1ada4dba8f9b.zip |
Eliminate redundant helper variables from src.rpm generation
- Spec being the first is easily detected from the current index,
no need for separate tracking variable
- Use the file records used variable to track the progress, no need
for separate index variable
Diffstat (limited to 'build')
-rw-r--r-- | build/files.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/build/files.c b/build/files.c index 513c3d5d2..9313da84c 100644 --- a/build/files.c +++ b/build/files.c @@ -1925,7 +1925,6 @@ static void genSourceRpmName(rpmSpec spec) rpmRC processSourceFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags) { struct Source *srcPtr; - int x, isSpec = 1; struct FileList_s fl; ARGV_t files = NULL; Package pkg; @@ -1968,11 +1967,10 @@ rpmRC processSourceFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags) parseForAttr(a, NULL, &fl.def); free(a); } - fl.files.recs = xcalloc((spec->numSources + 1), sizeof(*fl.files.recs)); + fl.files.alloced = spec->numSources + 1; + fl.files.recs = xcalloc(fl.files.alloced, sizeof(*fl.files.recs)); fl.pkgFlags = pkgFlags; - /* The first source file is the spec file */ - x = 0; for (ARGV_const_t fp = files; *fp != NULL; fp++) { const char *diskPath = *fp; char *tmp; @@ -1982,9 +1980,10 @@ rpmRC processSourceFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags) if (! *diskPath) continue; - flp = &fl.files.recs[x]; + flp = &fl.files.recs[fl.files.used]; - flp->flags = isSpec ? RPMFILE_SPECFILE : 0; + /* The first source file is the spec file */ + flp->flags = (fl.files.used == 0) ? RPMFILE_SPECFILE : 0; /* files with leading ! are no source files */ if (*diskPath == '!') { flp->flags |= RPMFILE_GHOST; @@ -2024,10 +2023,8 @@ rpmRC processSourceFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags) fl.processingFailed = 1; } - isSpec = 0; - x++; + fl.files.used++; } - fl.files.used = x; argvFree(files); if (! fl.processingFailed) { |