]> git.ipfire.org Git - thirdparty/squid.git/commit - src/external_acl.cc
Some changes and new features for MemBuf to make it more class-like
authorwessels <>
Thu, 1 Sep 2005 01:15:35 +0000 (01:15 +0000)
committerwessels <>
Thu, 1 Sep 2005 01:15:35 +0000 (01:15 +0000)
commit032785bf977564c1c54c3b1b5e707d4b1e071614
tree97142e75130627bdf564f6cd8e51dca0cb37af58
parentb6c13d0c182b6697a5792954726a6b1e83c222c7
Some changes and new features for MemBuf to make it more class-like
- made sure that cleaning a buffer that has not been initialized yet does
  not lead to coredumps (this is similar to deleting a null pointer in C++).
- Added consume() and append*() methods to allow the buffer to be used in a
  consumer/producer pipe-like environment.
- Added content() and space() methods as the first step to hide buf and size
  members that require consume() method to always shift content to keep a
  copyf of buf member valid (in case somebody made a copy of it).
- Noted that spaceSize() logic assumes the buffer does not expand and is
  0-terminated. This means that the following does not hold:
                max_capacity == contentSize() + spaceSize()
  Fortunately, max_capacity is a private member that nobody should be using
  outside of MemBuf.cc
  0-termination of a MemBuf? Can we make it explicit like string::c_str()?
- added hasContent() method
- Added public terminate() method because some HTTP parsing routines need it,
  unfortunately.
- Added potentialSpaceSize() to report how much space can be available
  after the buffer is grown to the max. Useful for callers that decide
  whether they _will_ have the space to store new data that they can get
  from somewhere.
- Use private copy and operator= methods to prevent us from creating a
  copy of a MemBuf.  MemBuf copies are bad because then two ->buf pointers
  point to the same location and its not clear who should free the memory.
- Added a destructor that asserts if someone forgot to free ->buf.  Good
  for finding memory leaks.

Restriction on not copying MemBufs must be propogated to MemBuf users.
In many cases this means changing "static" MemBufs to pointers.
22 files changed:
src/HttpBody.cc
src/HttpReply.cc
src/HttpReply.h
src/MemBuf.cc
src/MemBuf.cci
src/MemBuf.h
src/access_log.cc
src/client_side.cc
src/comm.cc
src/dns_internal.cc
src/errorpage.cc
src/external_acl.cc
src/helper.cc
src/http.cc
src/ident.cc
src/internal.cc
src/mime.cc
src/protos.h
src/structs.h
src/tunnel.cc
src/urn.cc
src/wais.cc