CalculiX  2.8
A Free Software Three-Dimensional Structural Finite Element Program
 All Classes Files Functions Variables Macros
u_realloc.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include "CalculiX.h"
Include dependency graph for u_realloc.c:

Go to the source code of this file.

Functions

void * u_realloc (void *ptr, size_t size, const char *file, const int line, const char *ptr_name)
 

Variables

int log_realloc
 

Function Documentation

void* u_realloc ( void *  ptr,
size_t  size,
const char *  file,
const int  line,
const char *  ptr_name 
)

Definition at line 28 of file u_realloc.c.

28  {
29 
30  /* reallocating a field with pointer ptr to size bytes */
31 
32  void *a;
33  char *env;
34 
35  a=realloc(ptr,size);
36 
37  if(a==NULL && ptr!=NULL && size!=0){
38  printf("*ERROR in u_realloc: error allocating memory\n");
39  printf("variable=%s, file=%s, line=%d, size(bytes)=%ld, oldaddress=%ld\n",ptr_name,file,line,size,(long int)ptr);
40  exit(16);
41  }
42  else {
43  if(log_realloc==-1) {
44  log_realloc=0;
45  env=getenv("CCX_LOG_ALLOC");
46  if(env) {log_realloc=atoi(env);}
47  }
48  if(log_realloc==1) {
49  printf("REALLOCATION of variable %s, file %s, line=%d: size(bytes)=%ld, oldaddress= %ld,address= %ld\n",ptr_name,file,line,size,(long int)ptr,(long int)a);
50  }
51  return(a);
52  }
53 }
int log_realloc
Definition: u_calloc.c:23

Variable Documentation

int log_realloc

Definition at line 23 of file u_calloc.c.

Hosted by OpenAircraft.com, (Michigan UAV, LLC)