]> git.saurik.com Git - apt.git/commitdiff
Improve some comments in the configuration parser.
authorDaniel Burrows <Daniel_Burrows@alumni.brown.edu>
Wed, 2 Apr 2008 03:49:58 +0000 (20:49 -0700)
committerDaniel Burrows <Daniel_Burrows@alumni.brown.edu>
Wed, 2 Apr 2008 03:49:58 +0000 (20:49 -0700)
apt-pkg/contrib/configuration.cc

index 3140be446cabbbb7b05541f7cb835a808e716dba..6f617e9148bdf9983e6fd482eb1338043ceda90e 100644 (file)
@@ -511,6 +511,8 @@ bool ReadConfigFile(Configuration &Conf,const string &FName,bool AsSectional,
       std::string Input;
       // The input line with comments stripped.
       std::string Fragment;
       std::string Input;
       // The input line with comments stripped.
       std::string Fragment;
+
+      // Grab the next line of F and place it in Input.
       do
        {
          char *Buffer = new char[1024];
       do
        {
          char *Buffer = new char[1024];
@@ -522,9 +524,9 @@ bool ReadConfigFile(Configuration &Conf,const string &FName,bool AsSectional,
        }
       while (F.fail() && !F.eof());
 
        }
       while (F.fail() && !F.eof());
 
+      // Expand tabs in the input line and remove leading and trailing
+      // whitespace.
       {
       {
-       // Allocate enough space to expand an entire line of tabs
-       // below.
        const int BufferSize = Input.size() * 8 + 1;
        char *Buffer = new char[BufferSize];
        try
        const int BufferSize = Input.size() * 8 + 1;
        char *Buffer = new char[BufferSize];
        try
@@ -544,6 +546,9 @@ bool ReadConfigFile(Configuration &Conf,const string &FName,bool AsSectional,
       }
       CurLine++;
 
       }
       CurLine++;
 
+      // Now strip comments; if the whole line is contained in a
+      // comment, skip this line.
+
       // The first meaningful character in the current fragment; will
       // be adjusted below as we remove bytes from the front.
       std::string::const_iterator Start = Input.begin();
       // The first meaningful character in the current fragment; will
       // be adjusted below as we remove bytes from the front.
       std::string::const_iterator Start = Input.begin();
@@ -623,8 +628,7 @@ bool ReadConfigFile(Configuration &Conf,const string &FName,bool AsSectional,
       if (Fragment.empty())
         continue;
       
       if (Fragment.empty())
         continue;
       
-      // We now have a valid line fragment.  Walk down it and
-      // interpret it.
+      // The line has actual content; interpret what it means.
       InQuote = false;
       Start = Fragment.begin();
       End = Fragment.end();
       InQuote = false;
       Start = Fragment.begin();
       End = Fragment.end();