MD5SumValue const &CurMd5, std::string const &CurLang);
using std::string;
+using APT::StringView;
// CacheGenerator::pkgCacheGenerator - Constructor /*{{{*/
// ---------------------------------------------------------------------
// CacheGenerator::NewGroup - Add a new group /*{{{*/
// ---------------------------------------------------------------------
/* This creates a new group structure and adds it to the hash table */
-bool pkgCacheGenerator::NewGroup(pkgCache::GrpIterator &Grp, const string &Name)
+bool pkgCacheGenerator::NewGroup(pkgCache::GrpIterator &Grp, StringView Name)
{
Grp = Cache.FindGrp(Name);
if (Grp.end() == false)
// Insert it into the hash table
unsigned long const Hash = Cache.Hash(Name);
map_pointer_t *insertAt = &Cache.HeaderP->GrpHashTableP()[Hash];
- while (*insertAt != 0 && strcasecmp(Name.c_str(), Cache.StrP + (Cache.GrpP + *insertAt)->Name) > 0)
+ while (*insertAt != 0 && Name.compare(Cache.StrP + (Cache.GrpP + *insertAt)->Name) > 0)
insertAt = &(Cache.GrpP + *insertAt)->Next;
Grp->Next = *insertAt;
*insertAt = Group;
// CacheGenerator::NewPackage - Add a new package /*{{{*/
// ---------------------------------------------------------------------
/* This creates a new package structure and adds it to the hash table */
-bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,const string &Name,
- const string &Arch) {
+bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg, StringView Name,
+ StringView Arch) {
pkgCache::GrpIterator Grp;
Dynamic<pkgCache::GrpIterator> DynGrp(Grp);
if (unlikely(NewGroup(Grp, Name) == false))
// Insert it into the hash table
map_id_t const Hash = Cache.Hash(Name);
map_pointer_t *insertAt = &Cache.HeaderP->PkgHashTableP()[Hash];
- while (*insertAt != 0 && strcasecmp(Name.c_str(), Cache.StrP + (Cache.GrpP + (Cache.PkgP + *insertAt)->Group)->Name) > 0)
+ while (*insertAt != 0 && Name.compare(Cache.StrP + (Cache.GrpP + (Cache.PkgP + *insertAt)->Group)->Name) > 0)
insertAt = &(Cache.PkgP + *insertAt)->NextPackage;
Pkg->NextPackage = *insertAt;
*insertAt = Package;
if (Arch == "any")
{
size_t const found = Name.find(':');
- std::string const NameA = Name.substr(0, found);
- std::string const ArchA = Name.substr(found + 1);
+ StringView const NameA = Name.substr(0, found);
+ StringView const ArchA = Name.substr(found + 1);
pkgCache::PkgIterator PkgA = Cache.FindPkg(NameA, ArchA);
if (PkgA.end() == false)
{
/* This creates a Group and the Package to link this dependency to if
needed and handles also the caching of the old endpoint */
bool pkgCacheListParser::NewDepends(pkgCache::VerIterator &Ver,
- const string &PackageName,
- const string &Arch,
- const string &Version,
+ StringView PackageName,
+ StringView Arch,
+ StringView Version,
uint8_t const Op,
uint8_t const Type)
{
{
int const CmpOp = Op & 0x0F;
// =-deps are used (79:1) for lockstep on same-source packages (e.g. data-packages)
- if (CmpOp == pkgCache::Dep::Equals && strcmp(Version.c_str(), Ver.VerStr()) == 0)
+ if (CmpOp == pkgCache::Dep::Equals && Version.compare(Ver.VerStr()) == 0)
idxVersion = Ver->VerStr;
if (idxVersion == 0)
/*}}}*/
// ListParser::NewProvides - Create a Provides element /*{{{*/
bool pkgCacheListParser::NewProvides(pkgCache::VerIterator &Ver,
- const string &PkgName,
- const string &PkgArch,
- const string &Version,
+ StringView PkgName,
+ StringView PkgArch,
+ StringView Version,
uint8_t const Flags)
{
pkgCache const &Cache = Owner->Cache;
}
/*}}}*/
// ListParser::NewProvidesAllArch - add provides for all architectures /*{{{*/
-bool pkgCacheListParser::NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Package,
- string const &Version, uint8_t const Flags) {
+bool pkgCacheListParser::NewProvidesAllArch(pkgCache::VerIterator &Ver, StringView Package,
+ StringView Version, uint8_t const Flags) {
pkgCache &Cache = Owner->Cache;
pkgCache::GrpIterator Grp = Cache.FindGrp(Package);
Dynamic<pkgCache::GrpIterator> DynGrp(Grp);
map_stringitem_t pkgCacheGenerator::StoreString(enum StringType const type, const char *S,
unsigned int Size)
{
- std::string const key(S, Size);
+ std::string key(S, Size);
std::unordered_map<std::string,map_stringitem_t> * strings;
switch(type) {
return item->second;
map_stringitem_t const idxString = WriteStringInMap(S,Size);
- strings->insert(std::make_pair(key, idxString));
+ strings->insert(std::make_pair(std::move(key), idxString));
return idxString;
}
/*}}}*/