Hi,

On Tue, 11 Jan 2000, Richard Levitte - VMS Whacker wrote:

> From: Geoff Thorpe <[EMAIL PROTECTED]>
> 
> geoff> plenty of *_copy() functions to deal with that ('twould seem that a copy
> geoff> ups the reference count on the new structure by definition so copy
> geoff> functions needn't have any form of switch between "r" and/or "i").
> 
> I'm not sure if that parenthesis is telling the current state of
> affairs or how it should be.  If it's the latter, the new copy of any
> structure should get a reference count of 1 and nothing else.  The
> reason should be obvious.

The "by definition" bit was supposed to indicate what you have described.
Namely, you get a copy of the original structure and a reference to that
structure (ref-count goes to 1 making it "alive"). A ref-count of zero is
not supposed to occur except during the last _free() call as a condition
for deallocating the structure. So when making the copy you are returning
a reference (not just a pointer) to that new structure, hence my note
that there's not much point to discuss "r" and "i" versions of a _copy()
function - a copy operation is creating a new reference, it's just
adding the reference in the copy rather than the original. Perhaps think
of it this way - any call to a _copy() function will require a
corresponding _free() (whether or not other code grabs further references
on that new copy).

Have I further muddled things up? :-)

Regards,
Geoff


----------------------------------------------------------------------
Geoff Thorpe                                    Email: [EMAIL PROTECTED]
Cryptographic Software Engineer, C2Net Europe    http://www.int.c2.net
----------------------------------------------------------------------

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to