Skip to content
  • Tor Didriksen's avatar
    f8b61d92
    Bug#18920203 GET RID OF DYNAMIC_ARRAY IN SERVER_IDS::DYNAMIC_I · f8b61d92
    Tor Didriksen authored
    Our array abstractions should be removed, and substituted with modern data
    structures.
      
    Templatized vectors are:
     - type safe
     - easier to read/maintain
     - faster
    
    Also: remove some dead code.
    The class Database_ids is unused, which means we can remove it,
    and the base class Dynamic_ids.
    The member function Server_ids::do_search_id is also unused,
    and can be removed.
    
    The macro sort_dynamic() is no longer in use, and can be removed.
    
    There was a bug in change_receive_options():
    If we are inserting multiple ids into mi->ignore_server_ids
    then we need to re-sort before doing a binary_search.
    The old code worked "by accident", bsearch() found an element,
    even though the array was no longer sorted after an insert_dynamic()
    
    The fix for the sort/bsearch() bug: implement insertion-sort in Prealloced_array,
    and use insert_unique() to keep the array sorted at all times.
    This is a short array of ints, with pre-allocation, so insert-sort should be fairly efficient.
    f8b61d92
    Bug#18920203 GET RID OF DYNAMIC_ARRAY IN SERVER_IDS::DYNAMIC_I
    Tor Didriksen authored
    Our array abstractions should be removed, and substituted with modern data
    structures.
      
    Templatized vectors are:
     - type safe
     - easier to read/maintain
     - faster
    
    Also: remove some dead code.
    The class Database_ids is unused, which means we can remove it,
    and the base class Dynamic_ids.
    The member function Server_ids::do_search_id is also unused,
    and can be removed.
    
    The macro sort_dynamic() is no longer in use, and can be removed.
    
    There was a bug in change_receive_options():
    If we are inserting multiple ids into mi->ignore_server_ids
    then we need to re-sort before doing a binary_search.
    The old code worked "by accident", bsearch() found an element,
    even though the array was no longer sorted after an insert_dynamic()
    
    The fix for the sort/bsearch() bug: implement insertion-sort in Prealloced_array,
    and use insert_unique() to keep the array sorted at all times.
    This is a short array of ints, with pre-allocation, so insert-sort should be fairly efficient.
Loading