diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2020-01-07 22:37:36 +0100 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2020-01-07 22:51:41 +0100 |
commit | df4b92bd1df204e7fb0d22e73e143d205d74aea6 (patch) | |
tree | 36c2ddc9d4b0d1457ebcd8cb98623c53abd1c9c7 | |
parent | 1b3e0a6a4bf673bd7d1da4a481eeb0a436430be8 (diff) |
Rename _count() macro to APT_ARRAY_SIZE()
-rw-r--r-- | apt-pkg/contrib/macros.h | 2 | ||||
-rw-r--r-- | apt-pkg/edsp.cc | 4 | ||||
-rw-r--r-- | apt-pkg/pkgcache.cc | 2 | ||||
-rw-r--r-- | methods/gpgv.cc | 3 |
4 files changed, 6 insertions, 5 deletions
diff --git a/apt-pkg/contrib/macros.h b/apt-pkg/contrib/macros.h index c19cb313d..e914b7298 100644 --- a/apt-pkg/contrib/macros.h +++ b/apt-pkg/contrib/macros.h @@ -46,7 +46,7 @@ /* Useful count macro, use on an array of things and it will return the number of items in the array */ -#define _count(a) (sizeof(a)/sizeof(a[0])) +#define APT_ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) // Flag Macros #define FLAG(f) (1L << (f)) diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc index 0d5fe150b..fe6f55dcb 100644 --- a/apt-pkg/edsp.cc +++ b/apt-pkg/edsp.cc @@ -94,7 +94,7 @@ static bool WriteScenarioVersion(FileFd &output, pkgCache::PkgIterator const &Pk // WriteScenarioDependency /*{{{*/ static bool WriteScenarioDependency(FileFd &output, pkgCache::VerIterator const &Ver, bool const OnlyCritical) { - std::array<std::string, _count(DepMap)> dependencies; + std::array<std::string, APT_ARRAY_SIZE(DepMap)> dependencies; bool orGroup = false; for (pkgCache::DepIterator Dep = Ver.DependsList(); Dep.end() == false; ++Dep) { @@ -141,7 +141,7 @@ static bool WriteScenarioLimitedDependency(FileFd &output, std::vector<bool> const &pkgset, bool const OnlyCritical) { - std::array<std::string, _count(DepMap)> dependencies; + std::array<std::string, APT_ARRAY_SIZE(DepMap)> dependencies; bool orGroup = false; for (pkgCache::DepIterator Dep = Ver.DependsList(); Dep.end() == false; ++Dep) { diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index 160c58273..f8ab423ae 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -381,7 +381,7 @@ const char *pkgCache::Priority(unsigned char Prio) { const char *Mapping[] = {0,_("required"),_("important"),_("standard"), _("optional"),_("extra")}; - if (Prio < _count(Mapping)) + if (Prio < APT_ARRAY_SIZE(Mapping)) return Mapping[Prio]; return 0; } diff --git a/methods/gpgv.cc b/methods/gpgv.cc index 660041764..1ca62557c 100644 --- a/methods/gpgv.cc +++ b/methods/gpgv.cc @@ -83,7 +83,8 @@ static constexpr Digest Digests[] = { static Digest FindDigest(std::string const & Digest) { int id = atoi(Digest.c_str()); - if (id >= 0 && static_cast<unsigned>(id) < _count(Digests)) { + if (id >= 0 && static_cast<unsigned>(id) < APT_ARRAY_SIZE(Digests)) + { return Digests[id]; } else { return Digests[0]; |