Quellcode durchsuchen

* apt-pkg/acquire-worker.cc:
- use Dump() to generate the configuration message for sending

David Kalnischkies vor 14 Jahren
Ursprung
Commit
d280d03ac5
2 geänderte Dateien mit 12 neuen und 31 gelöschten Zeilen
  1. 9 30
      apt-pkg/acquire-worker.cc
  2. 3 1
      debian/changelog

+ 9 - 30
apt-pkg/acquire-worker.cc

@@ -467,40 +467,19 @@ bool pkgAcquire::Worker::SendConfiguration()
 
    if (OutFd == -1)
       return false;
-   
-   string Message = "601 Configuration\n";
-   Message.reserve(2000);
 
-   /* Write out all of the configuration directives by walking the 
+   /* Write out all of the configuration directives by walking the
       configuration tree */
-   const Configuration::Item *Top = _config->Tree(0);
-   for (; Top != 0;)
-   {
-      if (Top->Value.empty() == false)
-      {
-	 string Line = "Config-Item: " + QuoteString(Top->FullTag(),"=\"\n") + "=";
-	 Line += QuoteString(Top->Value,"\n") + '\n';
-	 Message += Line;
-      }
-      
-      if (Top->Child != 0)
-      {
-	 Top = Top->Child;
-	 continue;
-      }
-      
-      while (Top != 0 && Top->Next == 0)
-	 Top = Top->Parent;
-      if (Top != 0)
-	 Top = Top->Next;
-   }   
-   Message += '\n';
+   std::ostringstream Message;
+   Message << "601 Configuration\n";
+   _config->Dump(Message, NULL, "Config-Item: %F=%V\n", false);
+   Message << '\n';
 
    if (Debug == true)
-      clog << " -> " << Access << ':' << QuoteString(Message,"\n") << endl;
-   OutQueue += Message;
-   OutReady = true; 
-   
+      clog << " -> " << Access << ':' << QuoteString(Message.str(),"\n") << endl;
+   OutQueue += Message.str();
+   OutReady = true;
+
    return true;
 }
 									/*}}}*/

+ 3 - 1
debian/changelog

@@ -5,8 +5,10 @@ apt (0.9.3) unstable; urgency=low
     - remove the message size limit from ioprintf and strprintf
   * apt-pkg/contrib/configuration.cc:
     - add a more versatile Dump() method
+  * apt-pkg/acquire-worker.cc:
+    - use Dump() to generate the configuration message for sending
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Sun, 22 Apr 2012 12:27:47 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Sun, 22 Apr 2012 12:28:13 +0200
 
 apt (0.9.2) unstable; urgency=low