Ignore:
Timestamp:
02/04/15 16:37:00 (10 years ago)
Author:
epyon
Message:
  • massive untracked updates
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/core/handle.hh

    r347 r350  
    8484                        value_type i = get_free_entry();
    8585                        m_entries[i].counter++;
     86                        NV_ASSERT( m_entries[i].counter != 0, "Out of handles!" );
    8687                        m_entries[i].next_free = USED;
    8788                        return hop::create( i, m_entries[i].counter );
     
    9091                void free_handle( handle h )
    9192                {
    92                         m_entries[h.index()].next_free = NONE;
    93                         if ( m_last_free == -1 )
     93                        value_type index = h.index();
     94                        typedef handle_operator<HANDLE> hop;
     95                        NV_ASSERT( m_entries[index].next_free == USED, "Unused handle freed!" );
     96                        NV_ASSERT( m_entries[index].counter == hop::get_counter( h ), "Handle corruption!" );
     97                        m_entries[index].next_free = NONE;
     98                        if ( m_last_free == NONE )
    9499                        {
    95                                 m_first_free = m_last_free = h.index();
     100                                m_first_free = m_last_free = index;
    96101                                return;
    97102                        }
    98                         m_entries[(unsigned)m_last_free].next_free = h.index();
    99                         m_last_free = h.index();
     103                        m_entries[(unsigned)m_last_free].next_free = index;
     104                        m_last_free = index;
    100105                }
    101106
     
    120125                value_type get_free_entry()
    121126                {
    122                         if ( m_first_free != -1 )
     127                        if ( m_first_free != NONE )
    123128                        {
    124129                                value_type result = (value_type)m_first_free;
    125130                                m_first_free = m_entries[result].next_free;
    126131                                m_entries[result].next_free = USED;
    127                                 if ( m_first_free == -1 ) m_last_free = -1;
     132                                if ( m_first_free == NONE ) m_last_free = NONE;
    128133                                return result;
    129134                        }
Note: See TracChangeset for help on using the changeset viewer.