this is my realloc version, is it good ? any suggestion are welcomed
#include &lt;stddef.h&gt;
#include &lt;stdlib.h&gt;

void    *ft_realloc(void *old_ptr, size_t old_size, size_t size) {
    if (size == 0 &amp;&amp; old_ptr != NULL)
    {
        free (old_ptr);
    }
    else if (old_ptr == NULL)
    {
        if (old_ptr = malloc(size))
        {
            ft_memset(old_ptr, 0, size);
            return (old_ptr);
        }
    }
    else
    {
        void *new_ptr;
        if (new_ptr = malloc(size))
        {
            ft_memset(new_ptr, 0, size);
            
            if (size &gt;= old_size)
                ft_strncpy (new_ptr, old_ptr, old_size);
            else
                ft_strncpy (new_ptr, old_ptr, size);
            
            free (old_ptr);
            return (new_ptr);
        }
    }
    return (NULL);
}

My insightful observation: OP's code has redundancies.
My answer: I removed some redundancies, which makes the code possible faster and easier to maintain.