Exemplo n.º 1
0
LIB_EXPORT
rc_t CC
XFSNodeRelease ( const struct XFSNode * self )
{
    rc_t RCt;
    int RefC;

    RCt = 0;
    RefC = 0;

    if ( self != NULL ) {
/*
pLogMsg ( klogDebug, "XFSNodeRelease ( $(node) )[$(name)]", "node=%p,name=%s", ( void * ) self, self -> Name );
*/
        RefC = KRefcountDrop (
                            & ( self -> refcount ),
                            _sXFSNode_classname
                            );
        switch ( RefC ) {
            case krefOkay :
            case krefZero :     RCt = 0; break;

            case krefWhack :    RCt = XFSNodeDispose ( self ); break;

            case krefNegative : RCt = XFS_RC ( rcInvalid ); break;
            default :           RCt = XFS_RC ( rcUnknown ); break;
        }
    }

    return RCt;
}   /* XFSNodeRelease () */
Exemplo n.º 2
0
/* Release
 *  discard reference to list
 *  ignores NULL references
 */
LIB_EXPORT rc_t CC KUrlFetcherRelease ( const KUrlFetcher *cself )
{
    KUrlFetcher *self = ( KUrlFetcher* ) cself;
    if ( cself != NULL )
    {
        switch ( KRefcountDrop ( & self -> refcount, classname ) )
        {
        case krefWhack:
            {
                rc_t rc;
                switch ( self -> vt -> v1 . maj )
                {
                case 1:
                    rc = ( * self -> vt -> v1 . destroy ) ( self );
                    break;

                default:
                    rc = RC ( rcApp, rcFunction, rcReleasing, rcInterface, rcBadVersion );
                }

                if ( rc != 0 )
                    KRefcountInit ( & self -> refcount, 1, classname, "failed-release", "orphan" );
                return rc;
            }
        case krefLimit:
            return RC ( rcApp, rcFunction, rcReleasing, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemplo n.º 3
0
LIB_EXPORT
rc_t CC
XFSGapKartItemRelease ( const struct XFSGapKartItem * self )
{
    rc_t RCt;

    RCt = 0;

    XFS_CAN ( self )

    switch ( KRefcountDrop ( & ( self -> refcount ), _sXFSGapKartItem_classname ) ) {

        case krefOkay :
        case krefZero :
                    RCt = 0;
                    break;
        case krefWhack :
                    RCt = _KartItemDispose ( ( struct XFSGapKartItem * ) self );
                    break;
        case krefNegative :
                    RCt = XFS_RC ( rcInvalid );
                    break;
        default :
                    RCt = XFS_RC ( rcUnknown );
                    break;
    }

    return RCt;
}   /* XFSGapKartItemRelease () */
Exemplo n.º 4
0
LIB_EXPORT
rc_t CC
XFSTreeRelease ( const struct XFSTree * self )
{
    rc_t RCt;

    RCt = 0;
    if ( self != NULL ) {
        switch ( KRefcountDrop (
                        & ( self -> refcount ),
                        _sXFSTree_classname
                        )
        ) {
            case krefOkay :
            case krefZero :
                RCt = 0;
                break;
            case krefWhack :
                RCt = XFSTreeDispose ( ( struct XFSTree * ) self );
                break;
            case krefNegative :
                RCt = XFS_RC ( rcInvalid );
                break;
            default :
                RCt = XFS_RC ( rcUnknown );
                break;
        }
    }

    return RCt;
}   /* XFSTreeRelease () */
Exemplo n.º 5
0
LIB_EXPORT rc_t CC KNSManagerRelease ( const KNSManager *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountDrop ( & self -> refcount, "KNSManager" ) )
        {
        case krefWhack:
            return KNSManagerWhack ( ( KNSManager * ) self );
        case krefNegative:
            return RC ( rcNS, rcMgr, rcAttaching, rcRefcount, rcInvalid );
        }
    }
    return 0;
}
Exemplo n.º 6
0
/* Release
 */
rc_t VLinkerRelease ( const VLinker *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountDrop ( & self -> refcount, "VLinker" ) )
        {
        case krefWhack:
            return VLinkerWhack ( ( VLinker* ) self );
        case krefNegative:
            return RC ( rcVDB, rcMgr, rcAttaching, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemplo n.º 7
0
LIB_EXPORT rc_t CC VTableRelease ( const VTable *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountDrop ( & self -> refcount, "VTable" ) )
        {
        case krefWhack:
            return VTableWhack ( ( VTable* ) self );
        case krefNegative:
            return RC ( rcVDB, rcTable, rcReleasing, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemplo n.º 8
0
LIB_EXPORT rc_t CC KDyldRelease ( const KDyld *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountDrop ( & self -> refcount, "KDyld" ) )
        {
        case krefWhack:
            return KDyldWhack ( ( KDyld* ) self );
        case krefLimit:
            return RC ( rcFS, rcDylib, rcReleasing, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemplo n.º 9
0
/* Release
 *  releases reference to object
 *  obtained from MakeRead, MakeUpdate,
 *  or AddRef(see above)
 */
LIB_EXPORT rc_t CC SRAMgrRelease ( const SRAMgr *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountDrop ( & self -> refcount, "SRAMgr" ) )
        {
        case krefWhack:
            return SRAMgrWhack ( ( SRAMgr* ) self );
        case krefLimit:
            return RC ( rcSRA, rcMgr, rcReleasing, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemplo n.º 10
0
LIB_EXPORT rc_t CC KColumnRelease ( const KColumn *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountDrop ( & self -> refcount, "KColumn" ) )
        {
        case krefWhack:
            return KColumnWhack ( ( KColumn* ) self );
        case krefNegative:
            return RC ( rcDB, rcColumn, rcReleasing, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemplo n.º 11
0
rc_t KDatabaseRelease ( const KDatabase *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountDrop ( & self -> refcount, "KDatabase" ) )
        {
        case krefWhack:
            return KDatabaseWhack ( ( KDatabase* ) self );
        case krefNegative:
            return RC ( rcDB, rcDatabase, rcReleasing, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemplo n.º 12
0
LIB_EXPORT rc_t CC KRepositoryMgrRelease ( const KRepositoryMgr *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountDrop ( & self -> refcount, "KRepositoryMgr" ) )
        {
        case krefWhack:
            return KRepositoryMgrWhack ( ( KRepositoryMgr* ) self );
        case krefLimit:
            return RC ( rcKFG, rcMgr, rcReleasing, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemplo n.º 13
0
LIB_EXPORT rc_t CC KDlsetRelease ( const KDlset *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountDrop ( & self -> refcount, "KDlset" ) )
        {
        case krefWhack:
            return KDlsetWhack ( ( KDlset* ) self );
        case krefNegative:
            return RC ( rcFS, rcDylib, rcReleasing, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemplo n.º 14
0
/* Release
 */
LIB_EXPORT rc_t CC KLockFileRelease ( const KLockFile *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountDrop ( & self -> refcount, "KLockFile" ) )
        {
        case krefWhack:
            return KLockFileWhack ( ( KLockFile* ) self );
        case krefNegative:
            return RC ( rcFS, rcLock, rcReleasing, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemplo n.º 15
0
rc_t KeyRingRelease(KKeyRing* self)
{
    if ( self != NULL )
    {
        switch ( KRefcountDrop ( & self -> refcount, "KKeyRing" ) )
        {
        case krefWhack:
            KeyRingWhack ( self );
        break;
        case krefNegative:
            return RC ( rcApp, rcEncryptionKey, rcReleasing, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemplo n.º 16
0
KRYPTO_EXTERN
rc_t CC KCipherRelease (const KCipher * self)
{
    if ( self != NULL )
    {
        switch (KRefcountDrop ( & self -> refcount, KCipherClassName))
        {
        case krefWhack:
            return KCipherWhack ((KCipher *)self);

        case krefNegative:
            return RC ( rcKrypto, rcCipher, rcReleasing, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemplo n.º 17
0
LIB_EXPORT rc_t CC KDatabaseRelease ( const KDatabase *cself )
{
    KDatabase *self = ( KDatabase* ) cself;
    if ( cself != NULL )
    {
        switch ( KRefcountDrop ( & self -> refcount, "KDatabase" ) )
        {
        case krefWhack:
            return KDatabaseWhack ( ( KDatabase* ) self );
        case krefLimit:
            return RC ( rcDB, rcDatabase, rcReleasing, rcRange, rcExcessive );
        }
        -- self -> opencount;
    }
    return 0;
}
Exemplo n.º 18
0
LIB_EXPORT rc_t CC AlignmentIteratorRelease( const AlignmentIterator * cself )
{
    rc_t rc = 0;
    if ( cself == NULL )
        rc = RC( rcAlign, rcIterator, rcReleasing, rcSelf, rcNull );
    else
    {
        if ( KRefcountDrop( &cself->refcount, "AlignmentIterator" ) == krefWhack )
        {
            AlignmentIterator * self = ( AlignmentIterator * ) cself;
            AlignMgrRelease ( self->amgr );
            if ( self->free_on_whack )
                free( self );
        }
    }
    return rc;
}
Exemplo n.º 19
0
static rc_t BamRecordRelease( const BamRecord* cself )
{
    if ( cself != NULL )
    {
        BamRecord *self = ( BamRecord* ) cself;
        switch ( KRefcountDrop ( & self ->seq.refcount, "BamRecord" ) )
        {
        case krefWhack:
            BamRecordWhack( self );
            break;
        default:
            /* TODO: handle other values */
            break;
        }
    }
    return 0;
}
Exemplo n.º 20
0
static rc_t BamSequenceRelease( const BamSequence* self )
{
    if ( self != NULL )
    {
        switch ( KRefcountDrop ( & self -> refcount, "BamSequence" ) )
        {
        case krefWhack:
            return BamRecordWhack ( BamSequenceToRecord(self) );

        case krefNegative:
            return RC ( RC_MODULE, rcData, rcDestroying, rcSelf, rcDestroyed );
        }
    }

    return 0;

}
Exemplo n.º 21
0
/* Release
 *  discard reference to file
 *  ignores NULL references
 */
LIB_EXPORT rc_t CC KStreamRelease ( const KStream *self )
{
    if ( self != NULL )
    {
        switch ( KRefcountDrop ( & self -> refcount, "KStream" ) )
        {
        case krefWhack:
            return KStreamDestroy ( ( KStream* ) self );
        case krefLimit:
            return RC ( rcNS, rcStream, rcReleasing, rcRange, rcExcessive );
        default:
            break;
        }
    }

    return 0;
}
Exemplo n.º 22
0
LIB_EXPORT rc_t CC SRATableRelease( const SRATable *self )
{
    rc_t rc = 0;
    
    if (self)
    {
        switch (KRefcountDrop(&self->refcount, "SRATable"))
        {
        case krefWhack:
            return SRATableWhack ( ( SRATable* ) self );
        case krefNegative:
            rc = RC (rcSRA, rcTable, rcDestroying, rcSelf, rcDestroyed);
            PLOGERR (klogInt,(klogInt, rc, "Released an SRATable $(B) with no more references",
                      PLOG_P(self)));
            break;
        }
    }
    return rc;
}
Exemplo n.º 23
0
Arquivo: pmem.c Projeto: ncbi/ncbi-vdb
LIB_EXPORT rc_t CC KMemBankRelease(const KMemBank *cself)
{
    KMemBank *const self = (KMemBank *)cself;
    if (self != NULL) {
        int const rslt = KRefcountDrop(&self->refcount, "KMemBank");
        switch(rslt) {
        case krefWhack:
            KMemBankWhack(self);
            break;
        case krefOkay:
            break;
        default:
            PLOGMSG(klogFatal, (klogFatal, "LOGIC ERROR - " __FILE__ ":$(line)", "line=%i", __LINE__));
            abort();
            return RC(rcFS, rcMemory, rcAttaching, rcConstraint, rcViolated);
        }
    }
    return 0;
}
Exemplo n.º 24
0
LIB_EXPORT rc_t CC ReferenceIteratorRelease ( const ReferenceIterator *cself )
{
    rc_t rc = 0;
    if ( cself == NULL )
        rc = RC( rcAlign, rcIterator, rcReleasing, rcSelf, rcNull );
    else
    {
        if ( KRefcountDrop( &cself->refcount, "ReferenceIterator" ) == krefWhack )
        {
            ReferenceIterator * self = ( ReferenceIterator * ) cself;
            /* we 'own' the records! - we have to destroy them, if some are left in here */
            clear_spot_group_list( &self->spot_groups );
            rc = PlacementSetIteratorRelease ( self->pl_set_iter );
            AlignMgrRelease ( self->amgr );
            free( self );
        }
    }
    return rc;
}
Exemplo n.º 25
0
rc_t KEntrezFetcherRelease ( const KEntrezFetcher *cself )
{
    KEntrezFetcher *self = ( KEntrezFetcher* ) cself;
    if ( cself != NULL )
    {
        switch ( KRefcountDrop ( & self -> refcount, classname ) )
        {
        case krefWhack:
            {
                KUrlFetcherRelease ( self -> url_fetcher );
                if ( self -> uri ) free( self -> uri );
                free( self );
                return 0;
            }
        case krefLimit:
            return RC ( rcApp, rcFunction, rcReleasing, rcRange, rcExcessive );
        }
    }
    return 0;
}
Exemplo n.º 26
0
LIB_EXPORT rc_t CC KNSManagerRelease( const struct KNSManager *self )
{
    rc_t rc = 0;
    if ( self != NULL )
    {
        switch ( KRefcountDrop( &self->refcount, knsmanager_classname ) )
        {
        case krefOkay:
        case krefZero:
            break;
        case krefWhack:
            rc = KNSManagerDestroy( ( struct KNSManager * )self );
            break;
        case krefNegative:
            return RC( rcNS, rcMgr, rcAttaching, rcRefcount, rcInvalid );
        default:
            rc = RC( rcNS, rcMgr, rcAttaching, rcRefcount, rcUnknown );
            break;            
        }
    }
    return rc;
}
Exemplo n.º 27
0
LIB_EXPORT rc_t CC KCurlRequestRelease( const struct KCurlRequest *self )
{
    rc_t rc = 0;
    if ( self != NULL )
    {
        switch ( KRefcountDrop( &self->refcount, kcurlrequest_classname ) )
        {
        case krefOkay:
        case krefZero:
            break;
        case krefWhack:
            rc = KCurlRequestDestroy( ( struct KCurlRequest * )self );
            break;
        case krefNegative:
            return RC( rcNS, rcFile, rcAttaching, rcRefcount, rcInvalid );
        default:
            rc = RC( rcNS, rcFile, rcAttaching, rcRefcount, rcUnknown );
            break;            
        }
    }
    return rc;
}
Exemplo n.º 28
0
LIB_EXPORT rc_t CC PlacementSetIteratorRelease ( const PlacementSetIterator *cself )
{
    rc_t rc = 0;
    if ( cself == NULL )
        rc = RC( rcAlign, rcIterator, rcReleasing, rcSelf, rcNull );
    else
    {
        if ( KRefcountDrop( &cself->refcount, "PlacementSetIterator" ) == krefWhack )
        {
            PlacementSetIterator * self = ( PlacementSetIterator * ) cself;

            pl_set_iter_clear_curr_ref_window( self );
            pl_set_iter_clear_curr_ref( self );

            /* release the DLList of pi-ref's and the pi's in it... */
            DLListWhack ( &self->pi_refs, pi_ref_whacker, NULL );

            AlignMgrRelease ( self->amgr );

            free( self );
        }
    }
    return rc;
}