Преглед на файлове

Move GHR outside of function and provide ctor to suppress compiler warning

Without ctor, compiler emits warning "unused variable ghr".
Tatsuhiro Tsujikawa преди 12 години
родител
ревизия
c26c1e234a
променени са 1 файла, в които са добавени 12 реда и са изтрити 7 реда
  1. 12 7
      src/DownloadEngine.cc

+ 12 - 7
src/DownloadEngine.cc

@@ -140,15 +140,20 @@ void executeCommand(std::deque<std::unique_ptr<Command>>& commands,
 }
 } // namespace
 
+namespace {
+class GHR {
+public:
+  GHR() {}
+  ~GHR()
+  {
+    global::globalHaltRequested = 5;
+  }
+};
+} // namespace
+
 int DownloadEngine::run(bool oneshot)
 {
-  class GHR {
-    public:
-      ~GHR() {
-        global::globalHaltRequested = 5;
-      }
-  } ghr;
-
+  GHR ghr;
   while(!commands_.empty() || !routineCommands_.empty()) {
     if(!commands_.empty()) {
       waitData();