void *av_realloc(void *ptr, size_t size)

{

#if CONFIG_MEMALIGN_HACK

    int diff;

#endif



    /* let's disallow possible ambiguous cases */

    if (size > (MAX_MALLOC_SIZE-16))

        return NULL;



#if CONFIG_MEMALIGN_HACK

    //FIXME this isn't aligned correctly, though it probably isn't needed

    if(!ptr) return av_malloc(size);

    diff= ((char*)ptr)[-1];

    return (char*)realloc((char*)ptr - diff, size + diff) + diff;

#else

    return realloc(ptr, size + !size);

#endif

}

void *av_realloc(void *ptr, size_t size)

{

#if CONFIG_MEMALIGN_HACK

    int diff;

#endif



    

    if (size > (MAX_MALLOC_SIZE-16))

        return NULL;



#if CONFIG_MEMALIGN_HACK

    

    if(!ptr) return av_malloc(size);

    diff= ((char*)ptr)[-1];

    return (char*)realloc((char*)ptr - diff, size + diff) + diff;

#else

    return realloc(ptr, size + !size);

#endif

}

void *FUNC_0(void *VAR_0, size_t VAR_1)

{

#if CONFIG_MEMALIGN_HACK

    int diff;

#endif



    

    if (VAR_1 > (MAX_MALLOC_SIZE-16))

        return NULL;



#if CONFIG_MEMALIGN_HACK

    

    if(!VAR_0) return av_malloc(VAR_1);

    diff= ((char*)VAR_0)[-1];

    return (char*)realloc((char*)VAR_0 - diff, VAR_1 + diff) + diff;

#else

    return realloc(VAR_0, VAR_1 + !VAR_1);

#endif

}

void *FUNC_0(void *VAR_0, size_t VAR_1)
{ #if CONFIG_MEMALIGN_HACK
int diff; #endif
if (VAR_1 > (MAX_MALLOC_SIZE-16))
return NULL; #if CONFIG_MEMALIGN_HACK
if(!VAR_0) return av_malloc(VAR_1); diff= ((char*)VAR_0)[-1]; return (char*)realloc((char*)VAR_0 - diff, VAR_1 + diff) + diff; #else
return realloc(VAR_0, VAR_1 + !VAR_1); #endif
}