Esempio n. 1
0
static rc_t list_adata_init (list_adata * self)
{
    VectorInit (&self->list, 0, 512);
    VectorInit (&self->sort, 0, 512);
    self->has_zombies = false;
    return 0;
}
Esempio n. 2
0
static void ng_remove_invalid_nodes( p_ng generator, const uint32_t invalid_nodes )
{
    Vector temp_nodes;
            
    /* create a temp. vector */
    VectorInit( &temp_nodes, 0, 5 );

    /* copy all valid nodes into the temp. vector */
    VectorForEach ( &(generator->nodes), false,
                    ng_copy_valid_nodes, &temp_nodes );

    /* clear all nodes so far... */
    VectorWhack( &(generator->nodes), ng_node_destroy, NULL );

    /* re-init the vector */
    VectorInit( &(generator->nodes ), 0, 5 );

    /* copy (swallow) the valid nodes back into the generator */
    VectorCopy ( &temp_nodes, &(generator->nodes) );

    /* correct the node count */
    generator->node_count -= invalid_nodes;

    /* destroy the temp-vector, DO NOT PASS vdn_node_destroy into it */            
    VectorWhack ( &temp_nodes, NULL, NULL );
}
void TestResize()
{
    Vector* vector = VectorInit(DEFAULT_CAPACITY);

    /* Implicitly trigger the resize function. */
    unsigned i;
    for (i = 0 ; i < SIZE_MID_TEST ; ++i)
       vector->push_back(vector, (void*)(intptr_t)i);

    /* Explicitly trigger the resize function. */
    CU_ASSERT(vector->resize(vector, SIZE_MID_TEST << 1) == true);
    CU_ASSERT(vector->resize(vector, SIZE_TNY_TEST) == true);
    VectorDeinit(vector);

    /* Test the garbage collection of resize function. */
    vector = VectorInit(DEFAULT_CAPACITY);
    vector->set_clean(vector, CleanElement);
    for (i = 0 ; i < SIZE_MID_TEST ; ++i) {
        Tuple* tuple = (Tuple*)malloc(sizeof(Tuple));
        tuple->first = i;
        tuple->second = i;
        vector->push_back(vector, tuple);
    }
    CU_ASSERT(vector->resize(vector, SIZE_TNY_TEST) == true);
    VectorDeinit(vector);
}
Esempio n. 4
0
rc_t
VViewCursorMake ( const VView * p_view, VViewCursor ** p_curs )
{
    rc_t rc;
    VViewCursor * curs = calloc ( 1, sizeof * curs );
    if ( curs == NULL )
    {
        rc = RC ( rcVDB, rcCursor, rcConstructing, rcMemory, rcExhausted );
    }
    else
    {
        rc = VViewAddRef ( p_view );
        if ( rc == 0 )
        {
            curs -> dad . vt = & VViewCursor_vt;
            curs -> view = p_view;
            VectorInit ( & curs -> dad . row, 1, 16 );
            VCursorCacheInit ( & curs -> dad . col, 0, 16 );
            VCursorCacheInit ( & curs -> dad . phys, 0, 16 );
            VCursorCacheInit ( & curs -> dad . prod, 0, 16 );
            VectorInit ( & curs -> dad . owned, 0, 64 );
            KRefcountInit ( & curs -> dad . refcount, 1, "VViewCursor", "make", "vcurs" );
            curs -> dad . state = vcConstruct;
            * p_curs = curs;
            return 0;
        }
        free ( curs );
    }
    return rc;
}
Esempio n. 5
0
LIB_EXPORT rc_t CC VNamelistMake( VNamelist **names, const uint32_t alloc_blocksize  )
{
    rc_t rc;

    if ( names == NULL )
        rc = RC ( rcCont, rcNamelist, rcConstructing, rcParam, rcNull );
    else
    {
        (*names)=malloc( sizeof(**names) );
        if (*names != NULL )
        {
            rc = KNamelistInit( &(*names)->dad, (const KNamelist_vt*) &sVNameList_vt );
            if ( rc == 0 )
            {
                VectorInit ( & (*names)->name_vector, 0, alloc_blocksize );
            }
            else
            {
                free( *names );
                *names = NULL;
            }
        }
        else
        {
            rc = RC( rcCont, rcNamelist, rcListing, rcParam, rcNull );
        }
    }
    return rc;
}
Esempio n. 6
0
rc_t num_gen_iterator_make( const num_gen* self, const num_gen_iter **iter )
{
    uint32_t count;
    
    if ( self == NULL )
        return RC( rcVDB, rcNoTarg, rcReading, rcSelf, rcNull );
    if ( iter == NULL )
        return RC( rcVDB, rcNoTarg, rcReading, rcParam, rcNull );

    *iter = NULL;
    count = VectorLength( &(self->nodes) );
    if ( count < 1 )
        return RC( rcVDB, rcNoTarg, rcReading, rcParam, rcNull );
    else
    {
        num_gen_iter *temp = calloc( 1, sizeof( num_gen_iter ) );
        if ( temp == NULL )
            return RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
        VectorInit( &(temp->nodes), 0, count );
        num_gen_copy_vector( &(self->nodes), &(temp->nodes ) );
        temp->total = num_gen_total_count( &(temp->nodes ) );
        *iter = temp;
    }
    return 0;
}
Esempio n. 7
0
/* helper function for range-check */
static void num_gen_remove_invalid_nodes( num_gen* self )
{
    Vector temp_nodes;
    uint32_t count = VectorLength( &(self->nodes) );
    
    if ( count < 1 )
        return;
    /* create a temp. vector */
    VectorInit( &temp_nodes, 0, count );

    /* copy all valid nodes into the temp. vector */
    VectorForEach ( &(self->nodes), false,
                    num_gen_copy_valid_nodes, &temp_nodes );

    /* clear all nodes so far...,
       DO NOT PASS num_gen_node_destroy into it */
    VectorWhack( &(self->nodes), NULL, NULL );

    /* initialize and copy (shallow) the valid nodes back
       into the generator */
    VectorCopy ( &temp_nodes, &(self->nodes) );

    /* destroy the temp-vector,
       DO NOT PASS num_gen_node_destroy into it */
    VectorWhack ( &temp_nodes, NULL, NULL );
}
Esempio n. 8
0
static rc_t gather_matepair_distances( Args * args, samdump_opts * opts )
{
    uint32_t count;
    rc_t rc = ArgsOptionCount( args, OPT_MATE_DIST, &count );
    if ( rc != 0 )
    {
        (void)PLOGERR( klogErr, ( klogErr, rc, "error counting comandline option '$(t)'", "t=%s", OPT_REGION ) );
    }
    else if ( count > 0 )
    {
        uint32_t i;

        VectorInit( &opts->mp_dist, 0, 10 );
        for ( i = 0; i < count && rc == 0; ++i )
        {
            const char * s;
            rc = ArgsOptionValue( args, OPT_MATE_DIST, i, &s );
            if ( rc != 0 )
            {
                (void)PLOGERR( klogErr, ( klogErr, rc, "error retrieving comandline option '$(t)'", "t=%s", OPT_MATE_DIST ) );
            }
            else
                rc = parse_and_add_matepair_dist( &opts->mp_dist, s );
        }
        opts->use_matepair_filter = ( VectorLength( &opts->mp_dist ) > 0 );
    }
    return rc;
}
Esempio n. 9
0
/* RemoteRepositories
 *  retrieve all remote repositories in a Vector
 */
LIB_EXPORT rc_t CC KRepositoryMgrRemoteRepositories ( const KRepositoryMgr *self,
    KRepositoryVector *remote_repositories )
{
    rc_t rc;

    if ( remote_repositories == NULL )
        rc = RC ( rcKFG, rcMgr, rcAccessing, rcParam, rcNull );
    else
    {
        VectorInit ( remote_repositories, 0, 8 );

        if ( self == NULL )
            rc = RC ( rcKFG, rcMgr, rcAccessing, rcSelf, rcNull );
        else
        {
            const KConfig *kfg = KRepositoryMgrGetROKConfig ( self );

            const KConfigNode *remote;
            rc = KConfigOpenNodeRead ( kfg, & remote, "/repository/remote" );
            if ( rc == 0 )
            {
                rc = KRepositoryMgrCategoryRepositories ( remote, krepRemoteCategory, remote_repositories );
                KConfigNodeRelease ( remote );
                if ( rc == 0 )
                    VectorReorder ( remote_repositories, KRepositorySort, NULL );
            }

            if ( rc != 0 )
                KRepositoryVectorWhack ( remote_repositories );
        }
    }

    return rc;
}
Esempio n. 10
0
/* UserRepositories
 *  retrieve all user repositories in a Vector
 */
LIB_EXPORT rc_t CC KRepositoryMgrUserRepositories ( const KRepositoryMgr *self,
    KRepositoryVector *user_repositories )
{
    rc_t rc;

    if ( user_repositories == NULL )
        rc = RC ( rcKFG, rcMgr, rcAccessing, rcParam, rcNull );
    else
    {
        VectorInit ( user_repositories, 0, 8 );

        if ( self == NULL )
            rc = RC ( rcKFG, rcMgr, rcAccessing, rcSelf, rcNull );
        else
        {
            const KConfig *kfg = KRepositoryMgrGetROKConfig ( self );

            const KConfigNode *user;
            rc = KConfigOpenNodeRead ( kfg, & user, "/repository/user" );
            if ( rc == 0 )
            {
                rc = KRepositoryMgrCategoryRepositories ( user, krepUserCategory, user_repositories );
                KConfigNodeRelease ( user );
                if ( rc == 0 )
                    VectorReorder ( user_repositories, KRepositorySort, NULL );
            }

            if ( rc != 0 )
                KRepositoryVectorWhack ( user_repositories );
        }
    }

    return rc;
}
Esempio n. 11
0
bool ng_set_range( p_ng generator,
                   const int64_t first, const uint64_t count )
{
    bool res = ( generator != NULL );
    if ( res )
    {
        uint64_t num_1 = first;
        uint64_t num_2;

        /* this is necessary because virtual columns which have a
           infinite row-range, get reported with first=1,count=0 */
        if ( count > 0 )
        {
            num_2 = first + count - 1;
        }
        else
        {
            num_2 = first;
        }
        
        /* clear all nodes so far... */
        VectorWhack( &(generator->nodes), ng_node_destroy, NULL );
        /* re-init the vector */
        VectorInit( &(generator->nodes ), 0, 5 );
        generator->node_count = 0;
        generator->curr_node = 0;
        generator->curr_node_sub_pos = 0;

        res = ng_add_node( generator, num_1, num_2 );
    }
    return res;
}
Esempio n. 12
0
/* Make
 *  create a dynamic loader object
 *
 *  "dl" [ OUT ] - return parameter for loader
 */
LIB_EXPORT rc_t CC KDyldMake ( KDyld **dlp )
{
    rc_t rc;

    if ( dlp == NULL )
        rc = RC ( rcFS, rcDylib, rcConstructing, rcParam, rcNull );
    else
    {
        KDyld *dl = malloc ( sizeof * dl );
        if ( dl == NULL )
            rc = RC ( rcFS, rcDylib, rcConstructing, rcMemory, rcExhausted );
        else
        {
            VectorInit ( & dl -> search, 1, 8 );
            KRefcountInit ( & dl -> refcount, 1, "KDyld", "make", "dl" );

            * dlp = dl;
            return 0;
        }

        * dlp = NULL;
    }

    return rc;
}
void TestIterator()
{
    Vector* vector = VectorInit(DEFAULT_CAPACITY);
    vector->set_clean(vector, CleanElement);

    unsigned i;
    for (i = 0 ; i < SIZE_SML_TEST ; ++i) {
        Tuple* tuple = (Tuple*)malloc(sizeof(Tuple));
        tuple->first = i;
        tuple->second = i;
        vector->push_back(vector, tuple);
    }

    void* tuple;
    i = 0;
    vector->first(vector, false);
    while (vector->next(vector, &tuple)) {
        CU_ASSERT_EQUAL(((Tuple*)tuple)->first, i);
        ++i;
    }

    i = SIZE_SML_TEST - 1;
    vector->first(vector, true);
    while (vector->reverse_next(vector, &tuple)) {
        CU_ASSERT_EQUAL(((Tuple*)tuple)->first, i);
        --i;
    }

    VectorDeinit(vector);
}
void TestSort()
{
    srand(time(NULL));

    void* tuples[SIZE_SML_TEST];
    unsigned i;
    for (i = 0 ; i < SIZE_SML_TEST ; ++i) {
        Tuple* tuple = (Tuple*)malloc(sizeof(Tuple));
        tuple->first = i;
        tuple->second = i;
        tuples[i] = tuple;
    }
    for (i = 0 ; i < SIZE_MID_TEST ; ++i) {
        int src = rand() % SIZE_SML_TEST;
        int tge = rand() % SIZE_SML_TEST;
        void* tuple = tuples[src];
        tuples[src] = tuples[tge];
        tuples[tge] = tuple;
    }

    Vector* vector = VectorInit(DEFAULT_CAPACITY);
    vector->set_clean(vector, CleanElement);

    for (i = 0 ; i < SIZE_SML_TEST ; ++i)
        vector->push_back(vector, tuples[i]);

    vector->sort(vector, SortElement);
    for (i = 0 ; i < SIZE_SML_TEST ; ++i) {
        void* tuple;
        vector->get(vector, i, &tuple);
        CU_ASSERT_EQUAL(((Tuple*)tuple)->first, i);
    }

    VectorDeinit(vector);
}
Esempio n. 15
0
/* helper to create a skiplist-node, walk the given the ref-region fo find and enter all skip positions */
static struct skiplist_ref_node * make_skiplist_ref_node( const struct reference_region * r )
{
    struct skiplist_ref_node * res = calloc( 1, sizeof *res );
    if ( res != NULL )
    {
        uint32_t i, n = VectorLength( &r->ranges );
        res->name = string_dup_measure ( r->name, NULL );
        VectorInit ( &res->skip_ranges, 0, 5 );
        /* walk the ranges-Vector of the reference-region */
        for ( i = 0; i < n; ++i )
        {
            const struct reference_range * rr = VectorGet ( &( r->ranges ), i );
            /* walk the skip-Vector of the reference-range */
            uint32_t j, n1 = VectorLength( &rr->skip );
            for ( j = 0; j < n1; ++j )
            {
                const struct skip_range * sr = VectorGet ( &( rr->skip ), j );
                if ( sr != NULL )
                {
                    struct skip_range * csr = make_skip_range( sr->start, sr->end );
                    if ( csr != NULL )
                        VectorAppend ( &( res->skip_ranges ), NULL, csr );
                }
            }
        }
        res->current_id = 0;
        res->current_skip_range = VectorGet ( &( res->skip_ranges ), 0 );
    }
    return res;
}
Esempio n. 16
0
/* -------------------------------------------------------------------- */
rc_t temp_registry_merge( temp_registry * self,
                          KDirectory * dir,
                          const char * output_filename,
                          size_t buf_size,
                          bool show_progress,
                          bool force,
                          compress_t compress )
{
    rc_t rc = 0;
    if ( self == NULL )
        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull );
    else if ( output_filename == NULL )
        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcNull );
    else
    {
        struct bg_progress * progress = NULL;
        
        if ( show_progress )
        {
            rc = KOutMsg( "concat :" );
            if ( rc == 0 )
            {
                uint64_t total = total_size( dir, &self -> lists );
                rc = bg_progress_make( &progress, total, 0, 0 ); /* progress_thread.c */
            }
        }
        
        if ( rc == 0 )
        {
            uint32_t first;
            uint32_t count = count_valid_entries( &self -> lists, &first ); /* above */
            if ( count == 1 )
            {
                /* we have only ONE set of files... */
                VNamelist * l = VectorGet ( &self -> lists, first );
                VNamelistReorder ( l, false );
                rc = execute_concat( dir,
                    output_filename,
                    l,
                    buf_size,
                    progress,
                    force,
                    compress ); /* concatenator.c */
            }
            else if ( count > 1 )
            {
                /* we have MULTIPLE sets of files... */
                cmn_merge cmn = { dir, output_filename, buf_size, progress, force, compress };
                on_merge_ctx omc = { &cmn, 0 };
                VectorInit( &omc . threads, 0, count );
                VectorForEach ( &self -> lists, false, on_merge, &omc );
                join_and_release_threads( &omc . threads ); /* helper.c */
            }
            
            bg_progress_release( progress ); /* progress_thread.c ( ignores NULL )*/
        }
    }
    return rc;
}
Esempio n. 17
0
rc_t run_sorter_pool( const sorter_params * params )
{
    rc_t rc = 0;
    uint64_t row_count = find_out_row_count( params );
    if ( row_count == 0 )
    {
        rc = RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcInvalid );
        ErrMsg( "multi_threaded_make_lookup: row_count == 0!" );
    }
    else
    {
        cmn_params cp;
        Vector threads;
        KThread * progress_thread = NULL;
        uint32_t prefix = 1;
        multi_progress progress;

        init_progress_data( &progress, row_count );
        VectorInit( &threads, 0, params->num_threads );
        init_cmn_params( &cp, params, row_count );
        
        if ( params->show_progress )
            rc = start_multi_progress( &progress_thread, &progress );
            
        while ( rc == 0 && cp.first < row_count )
        {
            sorter_params * sp = calloc( 1, sizeof *sp );
            if ( sp != NULL )
            {
                init_sorter_params( sp, params, prefix++ );
                rc = make_raw_read_iter( &cp, &sp->src );
                
                if ( rc == 0 )
                {
                    KThread * thread;
                    
                    if ( params->show_progress )
                        sp->sort_progress = &progress.progress_rows;
                    rc = KThreadMake( &thread, sort_thread_func, sp );
                    if ( rc != 0 )
                        ErrMsg( "KThreadMake( sort-thread #%d ) -> %R", prefix - 1, rc );
                    else
                    {
                        rc = VectorAppend( &threads, NULL, thread );
                        if ( rc != 0 )
                            ErrMsg( "VectorAppend( sort-thread #%d ) -> %R", prefix - 1, rc );
                    }
                }
                cp.first  += cp.count;
            }
        }

        join_and_release_threads( &threads );
        /* all sorter-threads are done now, tell the progress-thread to terminate! */
        join_multi_progress( progress_thread, &progress );
        rc = merge_pool_files( params );
    }
    return rc;
}
Esempio n. 18
0
/* allocate a matcher-column */
static p_mcol matcher_make_col( const char* name )
{
    p_mcol res = NULL;
    if ( name == NULL ) return res;
    if ( name[0] == 0 ) return res;
    res = calloc( 1, sizeof( mcol ) );
    /* because of calloc all members are zero! */
    if ( res != NULL )
    {
        res->name = string_dup_measure ( name, NULL );
        VectorInit( &(res->src_types), 0, 3 );
        VectorInit( &(res->dst_types), 0, 3 );
        VectorInit( &(res->pairs), 0, 6 );
        res->type_cast = NULL;
    }
    return res;
}
Esempio n. 19
0
/* initializes the matcher */
rc_t matcher_init( matcher** self )
{
    if ( self == NULL )
        return RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull );
    (*self) = calloc( 1, sizeof( matcher ) );
    if ( *self == NULL )
        return RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
    VectorInit( &((*self)->mcols), 0, 5 );
    return 0;
}
Esempio n. 20
0
/*
 * initializes a redact-val-list
*/
rc_t redact_vals_init( redact_vals** vals )
{
    if ( vals == NULL )
        return RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull );
    (*vals) = calloc( 1, sizeof( redact_vals ) );
    if ( *vals == NULL )
        return RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
    VectorInit( &((*vals)->vals), 0, 5 );
    return 0;
}
Esempio n. 21
0
static struct reference_region * make_reference_region( const char *name )
{
    struct reference_region *res = calloc( sizeof *res, 1 );
    if ( res != NULL )
    {
        res->name = string_dup_measure ( name, NULL );
        VectorInit ( &res->ranges, 0, 5 );
    }
    return res;
}
Esempio n. 22
0
static struct reference_range * make_range( const uint64_t start, const uint64_t end )
{
    struct reference_range *res = calloc( 1, sizeof *res );
    if ( res != NULL )
    {
        res->start = start;
        res->end = end;
        VectorInit ( &res->skip, 0, 5 );
    }
    return res;
}
Esempio n. 23
0
/*
 * initializes a column-definitions-list
*/
rc_t col_defs_init( col_defs** defs )
{
    if ( defs == NULL )
        return RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull );
    (*defs) = calloc( 1, sizeof( col_defs ) );
    if ( *defs == NULL )
        return RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
    VectorInit( &((*defs)->cols), 0, 5 );
    (*defs)->filter_idx = -1;
    return 0;
}
/*-----------------------------------------------------------------------------*
 *            Unit tests relevant to basic structure verification              *
 *-----------------------------------------------------------------------------*/
void TestNewDelete()
{
    Vector* vector;
    CU_ASSERT((vector = VectorInit(DEFAULT_CAPACITY)) != NULL);

    /* Enlarge the vector size to test the destructor. */
    unsigned i;
    for (i = 0 ; i < SIZE_SML_TEST ; ++i)
        CU_ASSERT(vector->push_back(vector, (void*)(intptr_t)i) == true);

    VectorDeinit(vector);
}
Esempio n. 25
0
rc_t num_gen_make( num_gen** self )
{
    if ( self == NULL )
        return RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull );

    *self = calloc( 1, sizeof( num_gen ) );
    if ( *self == NULL )
        return RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );

    VectorInit( &((*self)->nodes ), 0, 5 );
    return 0;
}
Esempio n. 26
0
void ThirdCube::CubeInit()
{
	if( m_bShuffle || m_bAnimation || m_bVictory )
		return;
	m_bPerfectCheck = false;
	m_bVictory = false;
	m_nNumber = 0;
	for(int i=0; i<27; ++i)
	{
		sprintf(m_szName, "%02dBox%02dNode", m_nNumbering, i+1);
		m_pkSceneManager->getSceneNode(m_szName)->resetToInitialState();	//	SceneNode를 초기 상태로
	}
	VectorInit( m_DumiVector );
	VectorInit( m_PerfectVector );

	while(m_RotInfoList.size())
	{
		delete m_RotInfoList.back();
		m_RotInfoList.pop_back();
	}
	m_nCount=0;
}
Esempio n. 27
0
/* a vector of column-definitions */
bool vdcd_init( col_defs** defs, const size_t str_limit )
{
    bool res = false;
    if ( defs == NULL ) return res;
    (*defs) = calloc( 1, sizeof( col_defs ) );
    if ( *defs )
    {
        VectorInit( &((*defs)->cols), 0, 5 );
        (*defs)->max_colname_chars = 0;
        res = true;
    }
    ( *defs )->str_limit = str_limit;
    return res;
}
Esempio n. 28
0
void HtInsertItem(const char *key, void *newentry, LPVECTOR *table, unsigned int tablelen) {
	unsigned int index;
	#ifdef HT_CASE_INSENSITIVE
		char *__key;
		
		__key = alloca(strlen(key) + 1);
		lcasecpy(__key, key);
	#endif
	index = hash((unsigned char *)__key) & (tablelen - 1);

	if (!table[index])
		table[index] = VectorInit(HT_INITIAL_SLOTS);
	table[index] = VectorAdd(table[index], newentry);
}
Esempio n. 29
0
rc_t ng_make( ng** generator )
{
    if ( generator == NULL )
    {
        return RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcNull );
    }
    (*generator) = calloc( 1, sizeof( ng ) );
    if ( *generator == NULL )
    {
        return RC( rcVDB, rcNoTarg, rcConstructing, rcMemory, rcExhausted );
    }
    VectorInit( &((*generator)->nodes ), 0, 5 );
    return 0;
}
Esempio n. 30
0
void rgn_init( regions *rgn )
{
    init_array_file( &rgn->hdf5_regions );

    VectorInit ( &rgn->read_Regions, 0, 5 );
    VectorInit ( &rgn->sort_Regions, 0, 5 );
    VectorInit ( &rgn->stock_Regions, 0, 5 );

    rgn->data_32 = NULL;
    rgn->data_32_len = 0;
    rgn->data_8 = NULL;
    rgn->data_8_len = 0;

    rgn->offset = 0;
    rgn->spot_id = 0;
    rgn->spot_len = 0;
    rgn->hq_rgn.start = 0;
    rgn->hq_rgn.end = 0;

    rgn_stat_init( &( rgn->stat ) );

    rgn->complete_table = NULL;
    rgn->table_index = NULL;
}