Exemple #1
0
LIB_EXPORT
rc_t CC
XFSNodeAddRef ( const struct XFSNode * self )
{
    rc_t RCt;
    int RefC;

    RCt = 0;
    RefC = 0;

    if ( self != NULL ) {
/*
pLogMsg ( klogDebug, "XFSNodeAddRef ( $(node) )[$(name)]", "node=%p,name=%s", ( void * ) self, self -> Name );
*/

        RefC = KRefcountAdd (
                        & ( self -> refcount ),
                        _sXFSNode_classname
                        );
        switch ( RefC ) {
            case krefOkay :     RCt = 0; break;
            
            case krefZero :
            case krefLimit :
            case krefNegative : RCt = XFS_RC ( rcInvalid ); break;

            default :           RCt = XFS_RC ( rcUnknown ); break;
        }
    }
    else {
        RCt = XFS_RC ( rcNull );
    }

    return RCt;
}   /* XFSNodeAddRef () */
Exemple #2
0
LIB_EXPORT
rc_t CC
XFSTreeAddRef ( const struct XFSTree * self )
{
    rc_t RCt;

    RCt = 0;

    if ( self != NULL ) {
        switch ( KRefcountAdd (
                    & ( self -> refcount ),
                    _sXFSTree_classname
                    )
        ) {
            case krefOkay :
                RCt = 0;
                break;
            case krefZero :
            case krefLimit :
            case krefNegative :
                RCt = XFS_RC ( rcInvalid );
                break;
            default :
                RCt = XFS_RC ( rcUnknown );
                break;
        }
    }
    else {
        RCt = XFS_RC ( rcNull );
    }

    return RCt;
}   /* XFSTreeAddRef () */
Exemple #3
0
static rc_t BamRecordAddRef( const BamRecord* self )
{
    assert(self);
    KRefcountAdd( & self->seq.refcount, "BamRecord" );
    /* TODO: handle rc from KRefcountAdd */
    return 0;
}
Exemple #4
0
LIB_EXPORT
rc_t CC
XFSGapKartItemAddRef ( const struct XFSGapKartItem * self )
{
    rc_t RCt;

    RCt = 0;

    XFS_CAN ( self )

    switch ( KRefcountAdd ( & ( self -> refcount ), _sXFSGapKartItem_classname ) ) {
        case krefOkay :
                    RCt = 0;
                    break;
        case krefZero :
        case krefLimit :
        case krefNegative :
                    RCt = XFS_RC ( rcInvalid );
                    break;
        default :
                    RCt = XFS_RC ( rcUnknown );
                    break;
    }

    return RCt;
}   /* XFSGapKartItemAddRef () */
Exemple #5
0
static rc_t BamSequenceAddRef( const BamSequence* self )
{
    switch (KRefcountAdd( & self->refcount, "BamSequence" ))
    {
    case krefLimit:
        return RC ( RC_MODULE, rcData, rcAttaching, rcRange, rcExcessive );
    case krefNegative:
        return RC ( RC_MODULE, rcData, rcAttaching, rcRefcount, rcInvalid );
    }
    return 0;
}
Exemple #6
0
/* AddRef
 *  creates a new reference
 *  ignores NULL references
 */
LIB_EXPORT rc_t CC KUrlFetcherAddRef ( const KUrlFetcher *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountAdd ( & self -> refcount, classname ) )
        {
        case krefLimit:
            return RC ( rcApp, rcFunction, rcAttaching, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemple #7
0
/* AddRef
 */
LIB_EXPORT rc_t CC VTableAddRef ( const VTable *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountAdd ( & self -> refcount, "VTable" ) )
        {
        case krefLimit:
            return RC ( rcVDB, rcTable, rcAttaching, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemple #8
0
rc_t KeyRingAddRef(KKeyRing* self)
{
    if ( self != NULL )
    {
        switch ( KRefcountAdd ( & self -> refcount, "KKeyRing" ) )
        {
        case krefLimit:
            return RC ( rcApp, rcEncryptionKey, rcAttaching, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemple #9
0
/* AddRef
 * Release
 */
LIB_EXPORT rc_t CC KDlsetAddRef ( const KDlset *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountAdd ( & self -> refcount, "KDlset" ) )
        {
        case krefLimit:
            return RC ( rcFS, rcDylib, rcAttaching, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemple #10
0
/* AddRef
 * Release
 *  all objects are reference counted
 *  NULL references are ignored
 */
LIB_EXPORT rc_t CC KColumnAddRef ( const KColumn *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountAdd ( & self -> refcount, "KColumn" ) )
        {
        case krefLimit:
            return RC ( rcDB, rcColumn, rcAttaching, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemple #11
0
/* AddRef
 */
LIB_EXPORT rc_t CC KLockFileAddRef ( const KLockFile *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountAdd ( & self -> refcount, "KLockFile" ) )
        {
        case krefLimit:
            return RC ( rcFS, rcLock, rcAttaching, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemple #12
0
/* AddRef
 * Release
 *  all objects are reference counted
 *  NULL references are ignored
 */
rc_t KDatabaseAddRef ( const KDatabase *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountAdd ( & self -> refcount, "KDatabase" ) )
        {
        case krefLimit:
            return RC ( rcDB, rcDatabase, rcAttaching, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemple #13
0
/* AddRef
 * Release
 */
LIB_EXPORT rc_t CC KRepositoryAddRef ( const KRepository *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountAdd ( & self -> refcount, "KRepository" ) )
        {
        case krefLimit:
            return RC ( rcKFG, rcNode, rcAttaching, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemple #14
0
/* AddRef
 *  attach a new reference to an existing object
 *  ( see above)
 */
LIB_EXPORT rc_t CC SRAMgrAddRef ( const SRAMgr *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountAdd ( & self -> refcount, "SRAMgr" ) )
        {
        case krefLimit:
            return RC ( rcSRA, rcMgr, rcAttaching, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemple #15
0
/* ----------------------------------------------------------------------
 * AddRef
 *   add a new owner to this class.  This will mean another instance of 
 *   KCipher used this Block Cipher
 */
KRYPTO_EXTERN
rc_t CC KCipherAddRef (const KCipher * self)
{
    if (self)
    {
        switch (KRefcountAdd (&self->refcount, KCipherClassName))
        {
        case krefLimit:
            return RC (rcKrypto, rcCipher, rcAttaching, rcRange, rcExcessive);
        }
    }
    return 0;
}
Exemple #16
0
LIB_EXPORT rc_t CC ReferenceIteratorAddRef ( const ReferenceIterator *self )
{
    rc_t rc = 0;
    if ( self == NULL )
        rc = RC( rcAlign, rcIterator, rcAttaching, rcSelf, rcNull );
    else
    {
        if ( KRefcountAdd( &self->refcount, "ReferenceIterator" ) != krefOkay )
        {
            rc = RC( rcAlign, rcIterator, rcAttaching, rcError, rcUnexpected );
        }
    }
    return rc;
}
Exemple #17
0
/* AddRef
 * Release
 *  all objects are reference counted
 *  NULL references are ignored
 */
LIB_EXPORT rc_t CC KDatabaseAddRef ( const KDatabase *cself )
{
    KDatabase *self = ( KDatabase* ) cself;
    if ( cself != NULL )
    {
        switch ( KRefcountAdd ( & self -> refcount, "KDatabase" ) )
        {
        case krefLimit:
            return RC ( rcDB, rcDatabase, rcAttaching, rcRange, rcExcessive );
        }
        ++ self -> opencount;
    }
    return 0;
}
Exemple #18
0
LIB_EXPORT rc_t CC PlacementSetIteratorAddRef ( const PlacementSetIterator *cself )
{
    rc_t rc = 0;
    if ( cself == NULL )
        rc = RC( rcAlign, rcIterator, rcAttaching, rcSelf, rcNull );
    else
    {
        if ( KRefcountAdd( &cself->refcount, "PlacementSetIterator" ) != krefOkay )
        {
            rc = RC( rcAlign, rcIterator, rcAttaching, rcError, rcUnexpected );
        }
    }
    return rc;
}
Exemple #19
0
LIB_EXPORT rc_t CC KNSManagerAddRef ( const KNSManager *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountAdd( &self->refcount, "KNSManager" ) )
        {
        case krefLimit:
            return RC ( rcNS, rcMgr, rcAttaching, rcRefcount, rcExcessive );
        case krefNegative:
            return RC ( rcNS, rcMgr, rcAttaching, rcRefcount, rcInvalid );
        }
    }
    return 0;
}
Exemple #20
0
/* AddRef
 * Release
 */
LIB_EXPORT rc_t CC KMemBankAddRef(const KMemBank *cself)
{
    KMemBank *const self = (KMemBank *)cself;
    if (self != NULL) {
        int const rslt = KRefcountAdd(&self->refcount, "KMemBank");
        assert(rslt == krefOkay);
        if (rslt != krefOkay) {
            PLOGMSG(klogFatal, (klogFatal, "LOGIC ERROR - " __FILE__ ":$(line)", "line=%i", __LINE__));
            abort();
            return RC(rcFS, rcMemory, rcAttaching, rcConstraint, rcViolated);
        }
    }
    return 0;
}
Exemple #21
0
/* AddRef
 *  creates a new reference
 *  ignores NULL references
 */
LIB_EXPORT rc_t CC KStreamAddRef ( const KStream *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountAdd ( & self -> refcount, "KStream" ) )
        {
        case krefLimit:
            return RC ( rcNS, rcStream, rcAttaching, rcRange, rcExcessive );
        case krefNegative:
            return RC ( rcNS, rcStream, rcAttaching, rcSelf, rcInvalid );
        default:
            break;
        }
    }
    return 0;
}
Exemple #22
0
LIB_EXPORT rc_t CC KNSManagerAddRef ( const struct KNSManager *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountAdd( &self->refcount, knsmanager_classname ) )
        {
        case krefOkay:
            break;
        case krefZero:
            return RC( rcNS, rcMgr, rcAttaching, rcRefcount, rcIncorrect);
        case krefLimit:
            return RC( rcNS, rcMgr, rcAttaching, rcRefcount, rcExhausted);
        case krefNegative:
            return RC( rcNS, rcMgr, rcAttaching, rcRefcount, rcInvalid);
        default:
            return RC( rcNS, rcMgr, rcAttaching, rcRefcount, rcUnknown);
        }
    }
    return 0;
}
Exemple #23
0
LIB_EXPORT rc_t CC KCurlRequestAddRef ( const struct KCurlRequest *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountAdd( &self->refcount, kcurlrequest_classname ) )
        {
        case krefOkay:
            break;
        case krefZero:
            return RC( rcNS, rcFile, rcAttaching, rcRefcount, rcIncorrect);
        case krefLimit:
            return RC( rcNS, rcFile, rcAttaching, rcRefcount, rcExhausted);
        case krefNegative:
            return RC( rcNS, rcFile, rcAttaching, rcRefcount, rcInvalid);
        default:
            return RC( rcNS, rcFile, rcAttaching, rcRefcount, rcUnknown);
        }
    }
    return 0;
}