void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size)
{
    if(min_size < *size)
        return ptr;
    *size= FFMAX(17*min_size/16 + 32, min_size);
    ptr= av_realloc(ptr, *size);
    if(!ptr)
        *size= 0;
    return ptr;
}
['int av_add_index_entry(AVStream *st,\n                            int64_t pos, int64_t timestamp, int size, int distance, int flags)\n{\n    AVIndexEntry *entries, *ie;\n    int index;\n    if((unsigned)st->nb_index_entries + 1 >= UINT_MAX / sizeof(AVIndexEntry))\n        return -1;\n    entries = av_fast_realloc(st->index_entries,\n                              &st->index_entries_allocated_size,\n                              (st->nb_index_entries + 1) *\n                              sizeof(AVIndexEntry));\n    if(!entries)\n        return -1;\n    st->index_entries= entries;\n    index= av_index_search_timestamp(st, timestamp, AVSEEK_FLAG_ANY);\n    if(index<0){\n        index= st->nb_index_entries++;\n        ie= &entries[index];\n        assert(index==0 || ie[-1].timestamp < timestamp);\n    }else{\n        ie= &entries[index];\n        if(ie->timestamp != timestamp){\n            if(ie->timestamp <= timestamp)\n                return -1;\n            memmove(entries + index + 1, entries + index, sizeof(AVIndexEntry)*(st->nb_index_entries - index));\n            st->nb_index_entries++;\n        }else if(ie->pos == pos && distance < ie->min_distance)\n            distance= ie->min_distance;\n    }\n    ie->pos = pos;\n    ie->timestamp = timestamp;\n    ie->min_distance= distance;\n    ie->size= size;\n    ie->flags = flags;\n    return index;\n}', 'void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size)\n{\n    if(min_size < *size)\n        return ptr;\n    *size= FFMAX(17*min_size/16 + 32, min_size);\n    ptr= av_realloc(ptr, *size);\n    if(!ptr)\n        *size= 0;\n    return ptr;\n}']