X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Packets%2FPacketImpl.cc;h=2bd41bea6db88ddc02216d5ac646f83d693ff203;hb=10985d71f77b627bc4da543d7114feb7c4529329;hp=92e0e2285937b3974766b34143a0741c8f5a2608;hpb=408efb5a03252b4a278f69ab9bc588af438c55de;p=senf.git diff --git a/Packets/PacketImpl.cc b/Packets/PacketImpl.cc index 92e0e22..2bd41be 100644 --- a/Packets/PacketImpl.cc +++ b/Packets/PacketImpl.cc @@ -36,6 +36,21 @@ /////////////////////////////////////////////////////////////////////////// // senf::detail::PacketImpl +// This function has a problem being inlined. Somehow, often when calling this, the size of the +// resulting inlined code would be huge. Need to further debug this. + +prefix_ void senf::detail::PacketImpl::release(refcount_t n) +{ + SENF_ASSERT(refcount_ >= n); + // uah ... we need to be extremely careful here. If refcount_ is n, we want to commit suicide, + // however the destructor will remove all PacketInterpreters from the list and will thereby + // decrement refcount -> only decrenebt refcount_ when *not* caling delete + if (refcount_ == n) + delete this; + else + refcount_ -= n; +} + // interpreter chain prefix_ void senf::detail::PacketImpl::appendInterpreter(PacketInterpreterBase * p)