deps/kb_meme/meme-5.0.1/src/buffer.c
/*
 * buf_set_capacity
 * Changes the capacity to the passed value.
 * If the new capacity is smaller than the
 * limit or position they are updated to 
 * equal it. If the new capacity is smaller
 * than the mark it is removed.
 */
buf_set_capacity
Changes the capacity to the passed value.
If the new capacity is smaller than the
limit or position they are updated to
equal it. If the new capacity is smaller
than the mark it is removed.
buf_set_capacity Changes the capacity to the passed value . If the new capacity is smaller than the limit or position they are updated to equal it . If the new capacity is smaller than the mark it is removed .
void buf_set_capacity(BUF_T *buf, int capacity, bool update_limit) {
  buf->buffer = mm_realloc(buf->buffer, sizeof(char)*capacity);
  buf->capacity = capacity;
  if (buf->limit > capacity) { 
    buf->limit = capacity;
    if (buf->position > capacity) {
      buf->position = capacity;
      if (buf->mark > capacity)
        buf->mark = -1;
    }
  } else if (update_limit) {
    buf->limit = capacity;
  }
}
void buf_set_capacity ( BUF_T * buf , int capacity , bool update_limit ) { buf -> buffer = mm_realloc ( buf -> buffer , sizeof ( char ) * capacity ) ; buf -> capacity = capacity ; if ( buf -> limit > capacity ) { buf -> limit = capacity ; if ( buf -> position > capacity ) { buf -> position = capacity ; if ( buf -> mark > capacity ) buf -> mark = -1 ; } } else if ( update_limit ) { buf -> limit = capacity ; } }
buf_set_capacity
 Changes the capacity to the passed value.
buf_set_capacity Changes the capacity to the passed value .