You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/02/18 18:55:02 UTC

[lucy-commits] svn commit: r1072086 - /incubator/lucy/trunk/clownfish/src/CFCBase.c

Author: marvin
Date: Fri Feb 18 17:55:02 2011
New Revision: 1072086

URL: http://svn.apache.org/viewvc?rev=1072086&view=rev
Log:
Allow 'self' to be NULL for calls to CFCBase_incref() and CFCBase_decref().

Modified:
    incubator/lucy/trunk/clownfish/src/CFCBase.c

Modified: incubator/lucy/trunk/clownfish/src/CFCBase.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/src/CFCBase.c?rev=1072086&r1=1072085&r2=1072086&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/src/CFCBase.c (original)
+++ incubator/lucy/trunk/clownfish/src/CFCBase.c Fri Feb 18 17:55:02 2011
@@ -43,13 +43,16 @@ CFCBase_destroy(CFCBase *self)
 CFCBase*
 CFCBase_incref(CFCBase *self)
 {
-    SvREFCNT_inc((SV*)self->perl_obj);
+    if (self) {
+        SvREFCNT_inc((SV*)self->perl_obj);
+    }
     return self;
 }
 
 unsigned
 CFCBase_decref(CFCBase *self)
 {
+    if (!self) { return 0; }
     unsigned modified_refcount = SvREFCNT((SV*)self->perl_obj) - 1;
     /* When the SvREFCNT for this Perl object falls to zero, DESTROY will be
      * invoked from Perl space for the class that the Perl object was blessed