]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup: convert class Client to C++11 initialization
authorAmos Jeffries <>
Mon, 3 Apr 2017 07:22:32 +0000 (19:22 +1200)
committerAmos Jeffries <>
Mon, 3 Apr 2017 07:22:32 +0000 (19:22 +1200)
src/clients/Client.cc
src/clients/Client.h

index 4f5e8ba620c7bb1be378a8849d4dec320c3ae15e..24a3b9bf33e958ada08a7258979fd30b9e829013 100644 (file)
 // implemented in client_side_reply.cc until sides have a common parent
 void purgeEntriesByUrl(HttpRequest * req, const char *url);
 
-Client::Client(FwdState *theFwdState): AsyncJob("Client"),
-    completed(false),
-    currentOffset(0),
-    responseBodyBuffer(NULL),
+Client::Client(FwdState *theFwdState) :
+    AsyncJob("Client"),
     fwd(theFwdState),
-    requestSender(NULL),
-#if USE_ADAPTATION
-    adaptedHeadSource(NULL),
-    adaptationAccessCheckPending(false),
-    startedAdaptation(false),
-#endif
-    receivedWholeRequestBody(false),
-    doneWithFwd(nullptr),
-    theVirginReply(NULL),
-    theFinalReply(NULL)
+    request(fwd->request)
 {
     entry = fwd->entry;
     entry->lock("Client");
-
-    request = fwd->request;
 }
 
 Client::~Client()
index d6f1548a92ba5ba724118208d71e0d47e74b1f96..36ca27cd7aac5f04579289e8011a383d46582b34 100644 (file)
@@ -83,7 +83,7 @@ public: // should be protected
 
 private:
     void serverComplete2();    /**< Continuation of serverComplete */
-    bool completed;            /**< serverComplete() has been called */
+    bool completed = false;            /**< serverComplete() has been called */
 
 protected:
     // kids customize these
@@ -157,11 +157,11 @@ protected:
     void adjustBodyBytesRead(const int64_t delta);
 
     // These should be private
-    int64_t currentOffset;  /**< Our current offset in the StoreEntry */
-    MemBuf *responseBodyBuffer; /**< Data temporarily buffered for ICAP */
+    int64_t currentOffset = 0;  /**< Our current offset in the StoreEntry */
+    MemBuf *responseBodyBuffer = nullptr; /**< Data temporarily buffered for ICAP */
 
 public: // should not be
-    StoreEntry *entry;
+    StoreEntry *entry = nullptr;
     FwdState::Pointer fwd;
     HttpRequestPointer request;
 
@@ -174,21 +174,21 @@ protected:
     CbcPointer<Adaptation::Initiate> adaptedHeadSource;  /**< to get adapted response headers */
     BodyPipe::Pointer adaptedBodySource;      /**< to consume adated response body */
 
-    bool adaptationAccessCheckPending;
-    bool startedAdaptation;
+    bool adaptationAccessCheckPending = false;
+    bool startedAdaptation = false;
 #endif
-    bool receivedWholeRequestBody; ///< handleRequestBodyProductionEnded called
+    bool receivedWholeRequestBody = false; ///< handleRequestBodyProductionEnded called
 
     /// whether we should not be talking to FwdState; XXX: clear fwd instead
     /// points to a string literal which is used only for debugging
-    const char *doneWithFwd;
+    const char *doneWithFwd = nullptr;
 
 private:
     void sendBodyIsTooLargeError();
     void maybePurgeOthers();
 
-    HttpReply *theVirginReply;       /**< reply received from the origin server */
-    HttpReply *theFinalReply;        /**< adapted reply from ICAP or virgin reply */
+    HttpReply *theVirginReply = nullptr;       /**< reply received from the origin server */
+    HttpReply *theFinalReply = nullptr;        /**< adapted reply from ICAP or virgin reply */
 };
 
 #endif /* SQUID_SRC_CLIENTS_CLIENT_H */