"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Common/MallocUtils.cpp" between
getdp-3.4.0-source.tgz and getdp-3.5.0-source.tgz

About: GetDP is a general finite element solver using mixed elements to discretize de Rham-type complexes in one, two and three dimensions.

MallocUtils.cpp  (getdp-3.4.0-source.tgz):MallocUtils.cpp  (getdp-3.5.0-source.tgz)
// GetDP - Copyright (C) 1997-2021 P. Dular and C. Geuzaine, University of Liege // GetDP - Copyright (C) 1997-2022 P. Dular and C. Geuzaine, University of Liege
// //
// See the LICENSE.txt file for license information. Please report all // See the LICENSE.txt file for license information. Please report all
// issues on https://gitlab.onelab.info/getdp/getdp/issues. // issues on https://gitlab.onelab.info/getdp/getdp/issues.
#include "GetDPConfig.h" #include "GetDPConfig.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "MallocUtils.h" #include "MallocUtils.h"
#include "Message.h" #include "Message.h"
#if !defined(HAVE_GMSH) #if !defined(HAVE_GMSH)
void *Malloc(size_t size) void *Malloc(size_t size)
{ {
void *ptr; void *ptr;
if(!size) if(!size) return (NULL);
return (NULL);
ptr = malloc(size); ptr = malloc(size);
if(ptr == NULL) if(ptr == NULL) Message::Fatal("Out of memory (buy some more RAM!)");
Message::Fatal("Out of memory (buy some more RAM!)");
return (ptr); return (ptr);
} }
void *Calloc(size_t num, size_t size) void *Calloc(size_t num, size_t size)
{ {
void *ptr; void *ptr;
if(!size) if(!size) return (NULL);
return (NULL);
ptr = calloc(num, size); ptr = calloc(num, size);
if(ptr == NULL) if(ptr == NULL) Message::Fatal("Out of memory (buy some more RAM!)");
Message::Fatal("Out of memory (buy some more RAM!)");
return (ptr); return (ptr);
} }
void *Realloc(void *ptr, size_t size) void *Realloc(void *ptr, size_t size)
{ {
if(!size) if(!size) return (NULL);
return (NULL);
ptr = realloc(ptr, size); ptr = realloc(ptr, size);
if(ptr == NULL) if(ptr == NULL) Message::Fatal("Out of memory (buy some more RAM!)");
Message::Fatal("Out of memory (buy some more RAM!)");
return (ptr); return (ptr);
} }
void Free(void *ptr) void Free(void *ptr)
{ {
if(ptr == NULL) if(ptr == NULL) return;
return;
free(ptr); free(ptr);
} }
#endif #endif
 End of changes. 8 change blocks. 
15 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)