Hi Atul!
I pushed the second patch in revision 84 of your public calitko-Gnutella branch.
Regarding you Packet::Data command, we don’t necessary need to promote it to a full-pledged class if we want to automate some behavior. Take a look a QSharedData and QSharedDataPointers and their “polymorphic” variants in Utils/Memory/SharedData.*. They take care of reference counting of the private data behind the scenes and we still use Data as a POD ;-). As Anders correctly suggested before, we should prefer to use QSharedData and QSharedDataPointer instead of implementing ref counting ourselves each time.
Regards,
Peter
atul wrote:Dear all,
I was able to do it…
Here is the latest patch… I think this idea is applicable elsewhere( other places ref counting is done… )
– cheerio atul
atul wrote:
Dear all
While browsing thru the code I found these two small refactorings…. Thanks to the tests as they told me where I went wrong ;-)
P.S. I, very much wanted to use qAtomicDetach in
Packet::invalidateHeader(). Elevating Packet::Data to a class status would let us use it… but, opinions vary - CHUCKLE ;-)— cheerio atul
