Skip to content
Snippets Groups Projects
  • Jonathan Schöbel's avatar
    95ba8a94
    Validator: deregister tag · 95ba8a94
    Jonathan Schöbel authored
    A registered tag can be deregistered by calling SH_Validator_deregister.
    The data is removed, but the space is not deallocated, if it is not at
    the end. This prevents copying data on removal and saves expensive calls
    to realloc. Instead the empty space is added to the list of free blocks,
    which allows to refill these spaces, if a new tag is being registered.
    The space is finally deallocated, if the validator is being deallocated
    or the tag written in the last block is removed. In this case, heavy
    iteration is performed, as the list of free blocks is not ordered. The
    next last tag at that time is determined by iterating over the list of
    free blocks until some it is not found.
    Note that even if there can be a lot of gaps in between, the Validator
    will not allocate more space until all these gaps are refilled when a
    new tag is registered, thus new space is only being allocated, if there
    is really not enough space left.
    Due to the 4 nested loops, there was an issue related to the
    72(80)-column rule. It can't be abided without severely impacting the
    readability of the code.
    95ba8a94
    History
    Validator: deregister tag
    Jonathan Schöbel authored
    A registered tag can be deregistered by calling SH_Validator_deregister.
    The data is removed, but the space is not deallocated, if it is not at
    the end. This prevents copying data on removal and saves expensive calls
    to realloc. Instead the empty space is added to the list of free blocks,
    which allows to refill these spaces, if a new tag is being registered.
    The space is finally deallocated, if the validator is being deallocated
    or the tag written in the last block is removed. In this case, heavy
    iteration is performed, as the list of free blocks is not ordered. The
    next last tag at that time is determined by iterating over the list of
    free blocks until some it is not found.
    Note that even if there can be a lot of gaps in between, the Validator
    will not allocate more space until all these gaps are refilled when a
    new tag is registered, thus new space is only being allocated, if there
    is really not enough space left.
    Due to the 4 nested loops, there was an issue related to the
    72(80)-column rule. It can't be abided without severely impacting the
    readability of the code.