Просмотр исходного кода

deblistparser: Make PrioList const

More safety, less writeable memory.
Julian Andres Klode лет назад: 10
Родитель
Сommit
f77ea39c94
2 измененных файлов с 3 добавлено и 3 удалено
  1. 2 2
      apt-pkg/deb/deblistparser.cc
  2. 1 1
      apt-pkg/deb/deblistparser.h

+ 2 - 2
apt-pkg/deb/deblistparser.cc

@@ -35,7 +35,7 @@
 
 using std::string;
 
-static debListParser::WordList PrioList[] = {
+static const debListParser::WordList PrioList[] = {
    {"required",pkgCache::State::Required},
    {"important",pkgCache::State::Important},
    {"standard",pkgCache::State::Standard},
@@ -921,7 +921,7 @@ bool debListParser::ParseProvides(pkgCache::VerIterator &Ver)
 // ListParser::GrabWord - Matches a word and returns			/*{{{*/
 // ---------------------------------------------------------------------
 /* Looks for a word in a list of words - for ParseStatus */
-bool debListParser::GrabWord(string Word,WordList *List,unsigned char &Out)
+bool debListParser::GrabWord(string Word,const WordList *List,unsigned char &Out)
 {
    for (unsigned int C = 0; List[C].Str != 0; C++)
    {

+ 1 - 1
apt-pkg/deb/deblistparser.h

@@ -50,7 +50,7 @@ class APT_HIDDEN debListParser : public pkgCacheListParser
    bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag,
 		     unsigned int Type);
    bool ParseProvides(pkgCache::VerIterator &Ver);
-   static bool GrabWord(std::string Word,WordList *List,unsigned char &Out);
+   static bool GrabWord(std::string Word,const WordList *List,unsigned char &Out);
    APT_HIDDEN unsigned char ParseMultiArch(bool const showErrors);
 
    public: