Remove bogus const from rpmGetPath() temporary targets
authorPanu Matilainen <pmatilai@redhat.com>
Sat, 15 Dec 2007 08:39:15 +0000 (10:39 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Sat, 15 Dec 2007 08:39:15 +0000 (10:39 +0200)
16 files changed:
build.c
build/build.c
build/files.c
build/pack.c
build/parsePreamble.c
build/parsePrep.c
build/spec.c
lib/fs.c
lib/psm.c
lib/rpmrc.c
lib/rpmts.c
lib/signature.c
lib/transaction.c
rpmdb/db3.c
rpmdb/rpmdb.c
rpmio/rpmfileutil.c

diff --git a/build.c b/build.c
index d1b7d0d..9c0cbf5 100644 (file)
--- a/build.c
+++ b/build.c
@@ -112,7 +112,7 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba)
     /* FIX: static zcmds heartburn */
     if (ba->buildMode == 't') {
        FILE *fp;
-       const char * specDir;
+       char * specDir;
        char * tmpSpecFile;
        char * cmd, * s;
        rpmCompressedMagic res = COMPRESSED_OTHER;
index 177cbd2..7a6074c 100644 (file)
@@ -27,7 +27,7 @@ static void doRmSource(rpmSpec spec)
 
     for (p = spec->sources; p != NULL; p = p->next) {
        if (! (p->flags & RPMBUILD_ISNO)) {
-           const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
+           char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
            rc = unlink(fn);
            fn = _free(fn);
        }
@@ -36,7 +36,7 @@ static void doRmSource(rpmSpec spec)
     for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
        for (p = pkg->icon; p != NULL; p = p->next) {
            if (! (p->flags & RPMBUILD_ISNO)) {
-               const char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
+               char *fn = rpmGetPath("%{_sourcedir}/", p->source, NULL);
                rc = unlink(fn);
                fn = _free(fn);
            }
index 6c1cb6b..206ada4 100644 (file)
@@ -922,7 +922,8 @@ static rpmRC parseForSimple(rpmSpec spec, Package pkg, char * buf,
           {
                static const char *_docdir_fmt = NULL;
                static int oneshot = 0;
-               const char *ddir, *fmt, *errstr;
+               char *ddir, *fmt;
+               errmsg_t errstr;
                if (!oneshot) {
                    _docdir_fmt = rpmExpand("%{?_docdir_fmt}", NULL);
                    if (!_docdir_fmt || !*_docdir_fmt)
@@ -1782,7 +1783,7 @@ static rpmRC processPackageFiles(rpmSpec spec, Package pkg,
     pkg->cpioList = NULL;
 
     if (pkg->fileFile) {
-       const char *ffn;
+       char *ffn;
        FILE * f;
        FD_t fd;
 
@@ -2123,7 +2124,7 @@ int processSourceFiles(rpmSpec spec)
            }
        }
 
-      {        const char * sfn;
+      {        char * sfn;
        sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
                "%{_sourcedir}/", srcPtr->source, NULL);
        appendLineStringBuf(sourceFiles, sfn);
@@ -2133,7 +2134,7 @@ int processSourceFiles(rpmSpec spec)
 
     for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
        for (srcPtr = pkg->icon; srcPtr != NULL; srcPtr = srcPtr->next) {
-           const char * sfn;
+           char * sfn;
            sfn = rpmGetPath( ((srcPtr->flags & RPMBUILD_ISNO) ? "!" : ""),
                "%{_sourcedir}/", srcPtr->source, NULL);
            appendLineStringBuf(sourceFiles, sfn);
index c405438..3087137 100644 (file)
@@ -116,7 +116,7 @@ static StringBuf addFileToTagAux(rpmSpec spec,
                const char * file, StringBuf sb)
 {
     char buf[BUFSIZ];
-    const char * fn = buf;
+    char * fn = buf;
     FILE * f;
     FD_t fd;
 
@@ -610,7 +610,7 @@ rpmRC packageBinaries(rpmSpec spec)
     Package pkg;
 
     for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
-       const char *fn;
+       char *fn;
 
        if (pkg->fileList == NULL)
            continue;
@@ -649,7 +649,7 @@ rpmRC packageBinaries(rpmSpec spec)
                       spec->sourcePkgId, 16);
        }
        
-       {   const char *binFormat = rpmGetPath("%{_rpmfilename}", NULL);
+       {   char *binFormat = rpmGetPath("%{_rpmfilename}", NULL);
            char *binRpm, *binDir;
            binRpm = headerSprintf(pkg->header, binFormat, rpmTagTable,
                               rpmHeaderFormats, &errorString);
@@ -664,7 +664,7 @@ rpmRC packageBinaries(rpmSpec spec)
            fn = rpmGetPath("%{_rpmdir}/", binRpm, NULL);
            if ((binDir = strchr(binRpm, '/')) != NULL) {
                struct stat st;
-               const char *dn;
+               char *dn;
                *binDir = '\0';
                dn = rpmGetPath("%{_rpmdir}/", binRpm, NULL);
                if (stat(dn, &st) < 0) {
@@ -721,7 +721,7 @@ rpmRC packageSources(rpmSpec spec)
     spec->cookie = _free(spec->cookie);
     
     /* XXX this should be %_srpmdir */
-    {  const char *fn = rpmGetPath("%{_srcrpmdir}/", spec->sourceRpmName,NULL);
+    {  char *fn = rpmGetPath("%{_srcrpmdir}/", spec->sourceRpmName,NULL);
 
        memset(csa, 0, sizeof(*csa));
        csa->cpioArchiveSize = 0;
index 761e3c9..9f4c6b6 100644 (file)
@@ -323,7 +323,7 @@ static void fillOutMainPackage(Header h)
  */
 static rpmRC readIcon(Header h, const char * file)
 {
-    const char *fn = NULL;
+    char *fn = NULL;
     char *icon;
     FD_t fd;
     rpmRC rc = RPMRC_OK;
index 13a130b..5306ec9 100644 (file)
@@ -121,7 +121,7 @@ static char *doPatch(rpmSpec spec, int c, int strip, const char *db,
     }
 
     if (compressed) {
-       const char *zipper = rpmGetPath(
+       char *zipper = rpmGetPath(
            (compressed == COMPRESSED_BZIP2 ? "%{_bzip2bin}" : "%{_gzipbin}"),
            NULL);
 
@@ -222,7 +222,7 @@ static const char *doUntar(rpmSpec spec, int c, int quietly)
     }
 
     if (compressed != COMPRESSED_NOT) {
-       const char *zipper;
+       char *zipper;
        int needtar = 1;
 
        switch (compressed) {
index e66c631..cdf5363 100644 (file)
@@ -319,7 +319,7 @@ int addSource(rpmSpec spec, Package pkg, const char *field, rpm_tag_t tag)
     spec->numSources++;
 
     if (tag != RPMTAG_ICON) {
-       const char *body = rpmGetPath("%{_sourcedir}/", p->source, NULL);
+       char *body = rpmGetPath("%{_sourcedir}/", p->source, NULL);
 
        sprintf(buf, "%s%d",
                (flag & RPMBUILD_ISPATCH) ? "PATCH" : "SOURCE", num);
index 075731c..7e34754 100644 (file)
--- a/lib/fs.c
+++ b/lib/fs.c
@@ -263,7 +263,7 @@ int rpmGetFilesystemUsage(const char ** fileList, int32_t * fssizes,
     char * chptr;
     int maxLen;
     char * lastDir;
-    const char * sourceDir;
+    char * sourceDir;
     int lastfs = 0;
     int lastDev = -1;          /* I hope nobody uses -1 for a st_dev */
     struct stat sb;
index 0cb956c..ea797d5 100644 (file)
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -655,7 +655,7 @@ static rpmRC runScript(rpmpsm psm, Header h, rpm_tag_t stag,
     if ((a != NULL && a[0] == 'i' && a[1] != '\0' && a[2] == '8' && a[3] == '6')
      && strcmp(argv[0], "/sbin/ldconfig"))
     {
-       const char * fmt = rpmGetPath("%{?_autorelocate_path}", NULL);
+       char * fmt = rpmGetPath("%{?_autorelocate_path}", NULL);
        const char * errstr;
        char * newPath;
        char * t;
@@ -1397,7 +1397,7 @@ assert(psm->mi == NULL);
        }
        if (psm->goal == PSM_PKGSAVE) {
            /* Open output package for writing. */
-           {   const char * bfmt = rpmGetPath("%{_repackage_name_fmt}", NULL);
+           {   char * bfmt = rpmGetPath("%{_repackage_name_fmt}", NULL);
                const char * pkgbn =
                        headerSprintf(fi->h, bfmt, rpmTagTable, rpmHeaderFormats, NULL);
 
index 1a8f043..2900188 100644 (file)
@@ -568,7 +568,8 @@ static rpmRC doReadRC( FD_t fd, const char * urlfn)
                         sizeof(optionTable[0]), optionCompare);
 
        if (option) {   /* For configuration variables  ... */
-           const char *arch, *val, *fn;
+           const char *arch, *val;
+           char *fn;
 
            arch = val = fn = NULL;
            if (*se == '\0') {
@@ -1687,7 +1688,7 @@ int rpmReadConfigFiles(const char * file, const char * target)
     if (rpmReadRC(file)) return -1;
 
     if (macrofiles != NULL) {
-       const char *mf = rpmGetPath(macrofiles, NULL);
+       char *mf = rpmGetPath(macrofiles, NULL);
        rpmInitMacros(NULL, mf);
        _free(mf);
     }
index bf7ca28..c511f17 100644 (file)
@@ -95,8 +95,7 @@ int rpmtsOpenDB(rpmts ts, int dbmode)
     ts->dbmode = dbmode;
     rc = rpmdbOpen(ts->rootDir, &ts->rdb, ts->dbmode, 0644);
     if (rc) {
-       const char * dn;
-       dn = rpmGetPath(ts->rootDir, "%{_dbpath}", NULL);
+       char * dn = rpmGetPath(ts->rootDir, "%{_dbpath}", NULL);
        rpmlog(RPMLOG_ERR,
                        _("cannot open Packages database in %s\n"), dn);
        dn = _free(dn);
@@ -567,8 +566,7 @@ int rpmtsOpenSDB(rpmts ts, int dbmode)
 
     rc = rpmdbOpen(ts->rootDir, &ts->sdb, ts->sdbmode, 0644);
     if (rc) {
-       const char * dn;
-       dn = rpmGetPath(ts->rootDir, "%{_dbpath}", NULL);
+       char * dn = rpmGetPath(ts->rootDir, "%{_dbpath}", NULL);
        rpmlog(RPMLOG_WARNING,
                        _("cannot open Solve database in %s\n"), dn);
        dn = _free(dn);
index 2422cf7..b3ce858 100644 (file)
@@ -67,7 +67,7 @@ const char * rpmDetectPGPVersion(pgpVersion * pgpVer)
     /* have one %_pgpbin and one %_pgp_path.                          */
 
     static pgpVersion saved_pgp_version = PGP_UNKNOWN;
-    const char *pgpbin = rpmGetPath("%{?_pgpbin}", NULL);
+    char *pgpbin = rpmGetPath("%{?_pgpbin}", NULL);
 
     if (saved_pgp_version == PGP_UNKNOWN) {
        char *pgpvbin;
index c97d6bc..bd5f774 100644 (file)
@@ -1353,7 +1353,7 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet)
     }
 
     if (!rpmtsFlags(ts) & RPMTRANS_FLAG_NOCONTEXTS) {
-       const char *fn = rpmGetPath("%{?_install_file_context_path}", NULL);
+       char *fn = rpmGetPath("%{?_install_file_context_path}", NULL);
        if (matchpathcon_init(fn) == -1) {
            rpmtsSetFlags(ts, (rpmtsFlags(ts) | RPMTRANS_FLAG_NOCONTEXTS));
        }
index 7e7fc1a..b741e62 100644 (file)
@@ -731,7 +731,7 @@ static int db3close(dbiIndex dbi, unsigned int flags)
        rc = cvtdberr(dbi, "db_create", rc, _debug);
 
        if (db != NULL) {
-               const char * dbf = rpmGetPath(dbhome, "/", dbfile, NULL);
+               char * dbf = rpmGetPath(dbhome, "/", dbfile, NULL);
 
                rc = db->verify(db, dbf, NULL, NULL, flags);
                rc = cvtdberr(dbi, "db->verify", rc, _debug);
@@ -883,7 +883,7 @@ static int db3open(rpmdb rpmdb, rpm_tag_t rpmtag, dbiIndex * dbip)
            }
 
        } else {        /* dbhome is writable, check for persistent dbenv. */
-           const char * dbf = rpmGetPath(dbhome, "/__db.001", NULL);
+           char * dbf = rpmGetPath(dbhome, "/__db.001", NULL);
 
            if (access(dbf, F_OK) == -1) {
                /* ... non-existent (or unwritable) DBENV, will create ... */
@@ -909,7 +909,7 @@ static int db3open(rpmdb rpmdb, rpm_tag_t rpmtag, dbiIndex * dbip)
     if ((oflags & DB_CREATE) && (oflags & DB_RDONLY)) {
        /* dbhome is writable, and DB->open flags may conflict. */
        const char * dbfn = (dbfile ? dbfile : rpmTagGetName(dbi->dbi_rpmtag));
-       const char * dbf = rpmGetPath(dbhome, "/", dbfn, NULL);
+       char * dbf = rpmGetPath(dbhome, "/", dbfn, NULL);
 
        if (access(dbf, F_OK) == -1) {
            /* File does not exist, DB->open might create ... */
index 03cc1ba..7074881 100644 (file)
@@ -3417,12 +3417,12 @@ int rpmdbRebuild(const char * prefix, rpmts ts,
                rpmRC (*hdrchk) (rpmts ts, const void *uh, size_t uc, const char ** msg))
 {
     rpmdb olddb;
-    const char * dbpath = NULL;
-    const char * rootdbpath = NULL;
+    char * dbpath = NULL;
+    char * rootdbpath = NULL;
     rpmdb newdb;
-    const char * newdbpath = NULL;
-    const char * newrootdbpath = NULL;
-    const char * tfn;
+    char * newdbpath = NULL;
+    char * newrootdbpath = NULL;
+    char * tfn;
     int nocleanup = 1;
     int failed = 0;
     int removedir = 0;
index e3b57e7..3722809 100644 (file)
@@ -519,7 +519,7 @@ const char * xmdir = rpmGetPath(urlmdir, NULL);
 const char * mdir = xmdir;
 const char * xfile = rpmGetPath(urlfile, NULL);
 const char * file = xfile;
-    const char * result;
+    char * result;
     const char * url = NULL;
     int nurl = 0;
     int ut;