/**
 * \file MemoryAlloc.cpp
 * Fonctions d'allocation memoire.
 * 
 * @author Nicolas Janey
 * @author nicolas.janey@univ-fcomte.fr
 * @version 1.0, 01/01/10
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void *myRealloc(void *src,int oldSize,int newSize) {
  if ( src ) {
    void *nl = calloc(newSize,1);
    if ( nl ) {
      memcpy(nl,src,(oldSize < newSize) ? oldSize : newSize); }
    free(src);
    return(nl); }
    else {
    void *nl = calloc(newSize,1);
    return(nl); }
}