Another pile of read-only constants marked as such..
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 7 Mar 2008 06:20:03 +0000 (08:20 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 7 Mar 2008 06:20:03 +0000 (08:20 +0200)
lib/formats.c
lib/package.c
lib/psm.c
lib/query.c
lib/rpmds.c
lib/rpmgi.c
lib/rpmlock.c
lib/rpmrc.c
lib/rpmts.c

index cb8f13c..4e2d457 100644 (file)
@@ -804,9 +804,9 @@ static int filerequireTag(Header h, rpmTagType* type,
 #if defined(ENABLE_NLS)
 extern int _nl_msg_cat_cntr;   /* XXX GNU gettext voodoo */
 #endif
-static const char * language = "LANGUAGE";
+static const char * const language = "LANGUAGE";
 
-static const char * _macro_i18ndomains = "%{?_i18ndomains}";
+static const char * const _macro_i18ndomains = "%{?_i18ndomains}";
 
 /**
  * Retrieve i18n text.
index 66af9e8..a784274 100644 (file)
@@ -23,7 +23,7 @@
 
 static int _print_pkts = 0;
 
-static unsigned int nkeyids_max = 256;
+static const unsigned int nkeyids_max = 256;
 static unsigned int nkeyids = 0;
 static unsigned int nextkeyid  = 0;
 static unsigned int * keyids;
index e71a9e8..3a00084 100644 (file)
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -107,9 +107,9 @@ int rpmVersionCompare(Header first, Header second)
  * @todo Should other macros be added from header when installing a package?
  */
 static struct tagMacro {
-const char *   macroname; /*!< Macro name to define. */
-    rpmTag     tag;            /*!< Header tag to use for value. */
-} tagMacros[] = {
+    const char *macroname;     /*!< Macro name to define. */
+    rpmTag tag;                        /*!< Header tag to use for value. */
+} const tagMacros[] = {
     { "name",          RPMTAG_NAME },
     { "version",       RPMTAG_VERSION },
     { "release",       RPMTAG_RELEASE },
@@ -126,7 +126,7 @@ const char *        macroname; /*!< Macro name to define. */
 static int rpmInstallLoadMacros(rpmfi fi, Header h)
 {
     HGE_t hge = (HGE_t) fi->hge;
-    struct tagMacro * tagm;
+    const struct tagMacro * tagm;
     union {
 void * ptr;
 const char ** argv;
index 111107c..09a7e17 100644 (file)
@@ -200,7 +200,7 @@ int showQueryPackage(QVA_t qva, rpmts ts, Header h)
        fstate = rpmfiFState(fi);
        fsize = rpmfiFSize(fi);
        fn = rpmfiFN(fi);
-       {   static char hex[] = "0123456789abcdef";
+       {   static char const hex[] = "0123456789abcdef";
            unsigned const char * s = rpmfiMD5(fi);
            char * p = fmd5;
            int j;
@@ -331,7 +331,7 @@ void rpmDisplayQueryTags(FILE * fp)
        if (t->name == NULL)
            continue;
        if (rpmIsVerbose()) {
-           static const char * tagtypes[] = {
+           static const char * const tagtypes[] = {
                "", "char", "int8", "int16", "int32", "int64",
                "string", "blob", "argv", "i18nstring"
            };
index 8bc6b73..915a0c0 100644 (file)
@@ -1014,7 +1014,7 @@ struct rpmlibProvides_s {
     const char * featureDescription;
 };
 
-static struct rpmlibProvides_s rpmlibProvides[] = {
+static const struct rpmlibProvides_s rpmlibProvides[] = {
     { "rpmlib(VersionedDependencies)", "3.0.3-1",
        (RPMSENSE_RPMLIB|RPMSENSE_EQUAL),
     N_("PreReq:, Provides:, and Obsoletes: dependencies support versions.") },
index d65d0cc..0adddd1 100644 (file)
@@ -53,9 +53,7 @@ struct rpmgi_s {
     int nrefs;                 /*!< Reference count. */
 };
 
-static int indent = 2;
-
-static const char * ftsInfoStrings[] = {
+static const char * const ftsInfoStrings[] = {
     "UNKNOWN",
     "D",
     "DC",
@@ -213,6 +211,8 @@ static rpmRC rpmgiWalkPathFilter(rpmgi gi)
     FTSENT * fts = gi->fts;
     rpmRC rpmrc = RPMRC_NOTFOUND;
     const char * s;
+    static const int indent = 2;
+
 
 if (_rpmgi_debug < 0)
 rpmlog(RPMLOG_DEBUG, "FTS_%s\t%*s %s%s\n", ftsInfoStr(fts->fts_info),
index d898af6..853368c 100644 (file)
@@ -13,7 +13,7 @@
 /* Internal interface */
 
 #define RPMLOCK_PATH LOCALSTATEDIR "/lock/rpm/transaction"
-static const char * rpmlock_path_default = "%{?_rpmlock_path}";
+static const char * const rpmlock_path_default = "%{?_rpmlock_path}";
 static const char * rpmlock_path = NULL;
 
 enum {
index 7b458d5..00f830d 100644 (file)
@@ -24,7 +24,7 @@
 
 #include "debug.h"
 
-static const char *defrcfiles = 
+static const char * const defrcfiles = 
       RPMCONFIGDIR "/rpmrc" 
   ":" RPMCONFIGDIR "/" RPMCANONVENDOR "/rpmrc"
   ":" SYSCONFDIR "/rpmrc"
@@ -42,7 +42,7 @@ const char * macrofiles =
   MACROFILES;
 #endif
 
-static const char * platform = SYSCONFDIR "/rpm/platform";
+static const char * const platform = SYSCONFDIR "/rpm/platform";
 static char ** platpat = NULL;
 static int nplatpat = 0;
 
@@ -132,13 +132,13 @@ static struct tableType_s tables[RPM_MACHTABLE_COUNT] = {
 /* this *must* be kept in alphabetical order */
 /* The order of the flags is archSpecific, required, macroize, localize */
 
-static struct rpmOption optionTable[] = {
+static const struct rpmOption const optionTable[] = {
     { "include",               RPMVAR_INCLUDE,                 0, 1,   0, 2 },
     { "macrofiles",            RPMVAR_MACROFILES,              0, 0,   0, 1 },
     { "optflags",              RPMVAR_OPTFLAGS,                1, 0,   1, 0 },
 };
 
-static size_t optionTableSize = sizeof(optionTable) / sizeof(*optionTable);
+static const size_t optionTableSize = sizeof(optionTable) / sizeof(*optionTable);
 
 #define OS     0
 #define ARCH   1
@@ -447,7 +447,7 @@ static void setPathDefault(const char * macroname, const char * subdir)
     }
 }
 
-static const char * prescriptenviron = "\n\
+static const char * const prescriptenviron = "\n\
 RPM_SOURCE_DIR=\"%{_sourcedir}\"\n\
 RPM_BUILD_DIR=\"%{_builddir}\"\n\
 RPM_OPT_FLAGS=\"%{optflags}\"\n\
@@ -1753,7 +1753,7 @@ int rpmReadConfigFiles(const char * file, const char * target)
 
 int rpmShowRC(FILE * fp)
 {
-    struct rpmOption *opt;
+    const struct rpmOption *opt;
     rpmds ds = NULL;
     int i, xx;
     machEquivTable equivTable;
index ee4ecf5..2b26bc2 100644 (file)
@@ -150,8 +150,8 @@ int rpmtsVerifyDB(rpmts ts)
 
 static int isArch(const char * arch)
 {
-    const char ** av;
-    static const char *arches[] = {
+    const char * const * av;
+    static const char * const arches[] = {
        "i386", "i486", "i586", "i686", "athlon", "pentium3", "pentium4", "x86_64", "amd64", "ia32e", "geode",
        "alpha", "alphaev5", "alphaev56", "alphapca56", "alphaev6", "alphaev67",
        "sparc", "sun4", "sun4m", "sun4c", "sun4d", "sparcv8", "sparcv9", "sparcv9v",
@@ -869,7 +869,7 @@ void rpmtsEmpty(rpmts ts)
 
 static void rpmtsPrintStat(const char * name, struct rpmop_s * op)
 {
-    static unsigned int scale = (1000 * 1000);
+    static const unsigned int scale = (1000 * 1000);
     if (op != NULL && op->count > 0)
        fprintf(stderr, "   %s %6d %6lu.%06lu MB %6lu.%06lu secs\n",
                name, op->count,