From df4b92bd1df204e7fb0d22e73e143d205d74aea6 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 7 Jan 2020 22:37:36 +0100 Subject: Rename _count() macro to APT_ARRAY_SIZE() --- apt-pkg/contrib/macros.h | 2 +- apt-pkg/edsp.cc | 4 ++-- apt-pkg/pkgcache.cc | 2 +- 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 dependencies; + std::array 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 const &pkgset, bool const OnlyCritical) { - std::array dependencies; + std::array 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(id) < _count(Digests)) { + if (id >= 0 && static_cast(id) < APT_ARRAY_SIZE(Digests)) + { return Digests[id]; } else { return Digests[0]; -- cgit v1.2.3