/* Whack */ static void NGS_StringWhack ( NGS_String * self, ctx_t ctx ) { if ( self -> orig != NULL ) NGS_StringRelease ( self -> orig, ctx ); if ( self -> owned != NULL ) free ( self -> owned ); }
static void SRA_DB_ReadCollectionWhack ( SRA_DB_ReadCollection * self, ctx_t ctx ) { NGS_CursorRelease ( self -> curs, ctx ); SRA_ReadGroupInfoRelease ( self -> group_info, ctx ); VDatabaseRelease ( self -> db ); NGS_StringRelease ( self -> run_name, ctx ); }
/* Invalidate */ void NGS_StringInvalidate ( NGS_String * self, ctx_t ctx ) { if ( self != NULL ) { NGS_String * orig = self -> orig; self -> size = 0; self -> str = ""; if ( orig != NULL ) { self -> orig = NULL; NGS_StringRelease ( orig, ctx ); } } }
static void DictionaryEntryWhack ( BSTNode *n, void *data ) { ctx_t ctx = ( ctx_t ) data; FUNC_ENTRY ( ctx, rcSRA, rcDatabase, rcDestroying ); DictionaryEntry* entry = ( DictionaryEntry * ) n; if ( entry -> type == NGS_StatisticValueType_String ) { NGS_StringRelease ( entry -> value . str, ctx ); } free ( n ); }
std :: string toString ( const NGS_String* str, ctx_t ctx, bool release_source = false ) { if ( str == 0 ) { throw std :: logic_error ( "toString ( NULL ) called" ); } std :: string ret = std::string ( NGS_StringData ( str, ctx ), NGS_StringSize ( str, ctx ) ); if ( release_source ) { NGS_StringRelease ( str, ctx ); } return ret; }