]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/HttpBody.cc
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / HttpBody.cc
index 50a161301eece5a34cb5e460f2eca685efd30f86..adfff9d9f5dda67364a2cc12896d76e4be1e4645 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
@@ -9,41 +9,14 @@
 /* DEBUG: section 56    HTTP Message Body */
 
 #include "squid.h"
+#include "base/Packable.h"
 #include "HttpBody.h"
-#include "MemBuf.h"
-
-HttpBody::HttpBody() : mb(new MemBuf)
-{}
-
-HttpBody::~HttpBody()
-{
-    delete mb;
-}
-
-void
-HttpBody::clear()
-{
-    mb->clean();
-}
-
-/* set body by absorbing mb */
-void
-HttpBody::setMb(MemBuf * mb_)
-{
-    delete mb;
-    /* note: protection against assign-to-self is not needed
-     * as MemBuf doesn't have a copy-constructor. If such a constructor
-     * is ever added, add such protection here.
-     */
-    mb = mb_;       /* absorb */
-}
 
 void
 HttpBody::packInto(Packable * p) const
 {
     assert(p);
-
-    if (mb->contentSize())
-        p->append(mb->content(), mb->contentSize());
+    if (const auto size = contentSize())
+        p->append(content(), size);
 }