Re: cvs commit: squid3/src/ICAP ICAPConfig.cc MsgPipeData.h

From: Henrik Nordstrom <henrik@dont-contact.us>
Date: Sat, 25 Feb 2006 17:04:40 +0100

fre 2006-02-24 klockan 18:21 -0700 skrev Duane Wessels:

> Because I think its annoying to have to write
>
> if (foo) {
> foo->unlock();
> foo = NULL;
> }
>
> in so many places.

Indeed.

> I started down that path and wasted about 4 days on it. Switching
> from normal pointers to ::Pointer is not pleasant for something
> that is used so pervasively.

Not sure I see the problem. The typing overhead in the source should be
the same as in the macro approach, except that it can be automated a bit
more..

But in this light the macro change if expanding to something like the
above is in fact a step forward, unifying the code and making the
refcount transition easier.

In fact this reminds me of the cbdata macros..

   pointer = cbdataReference(original_pointer);

   cbdataReferenceDone(pointer);

where cbdataReferenceDone is essentially the if block quoted above, plus
some cosmetics for debugging purposes.

Regards
Henrik

Received on Sat Feb 25 2006 - 09:04:45 MST

This archive was generated by hypermail pre-2.1.9 : Tue Feb 28 2006 - 12:00:05 MST