From 3be0a4b2f863e213af45b0495254108c13415a1f Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 7 Mar 2008 08:20:03 +0200 Subject: Another pile of read-only constants marked as such.. --- lib/formats.c | 4 ++-- lib/package.c | 2 +- lib/psm.c | 8 ++++---- lib/query.c | 4 ++-- lib/rpmds.c | 2 +- lib/rpmgi.c | 6 +++--- lib/rpmlock.c | 2 +- lib/rpmrc.c | 12 ++++++------ lib/rpmts.c | 6 +++--- 9 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/formats.c b/lib/formats.c index cb8f13c50..4e2d457b4 100644 --- a/lib/formats.c +++ b/lib/formats.c @@ -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. diff --git a/lib/package.c b/lib/package.c index 66af9e860..a78427420 100644 --- a/lib/package.c +++ b/lib/package.c @@ -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; diff --git a/lib/psm.c b/lib/psm.c index e71a9e869..3a000844d 100644 --- 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; diff --git a/lib/query.c b/lib/query.c index 111107cf6..09a7e1789 100644 --- a/lib/query.c +++ b/lib/query.c @@ -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" }; diff --git a/lib/rpmds.c b/lib/rpmds.c index 8bc6b7381..915a0c034 100644 --- a/lib/rpmds.c +++ b/lib/rpmds.c @@ -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.") }, diff --git a/lib/rpmgi.c b/lib/rpmgi.c index d65d0cccf..0adddd14e 100644 --- a/lib/rpmgi.c +++ b/lib/rpmgi.c @@ -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), diff --git a/lib/rpmlock.c b/lib/rpmlock.c index d898af641..853368c89 100644 --- a/lib/rpmlock.c +++ b/lib/rpmlock.c @@ -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 { diff --git a/lib/rpmrc.c b/lib/rpmrc.c index 7b458d52a..00f830d9a 100644 --- a/lib/rpmrc.c +++ b/lib/rpmrc.c @@ -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; diff --git a/lib/rpmts.c b/lib/rpmts.c index ee4ecf5bb..2b26bc2b3 100644 --- a/lib/rpmts.c +++ b/lib/rpmts.c @@ -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, -- cgit v1.2.3