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

Go to the source code of this file.

Functions

void * u_calloc (size_t num, size_t size, const char *file, const int line, const char *ptr_name)
 

Variables

int log_realloc =-1
 

Function Documentation

void* u_calloc ( size_t  num,
size_t  size,
const char *  file,
const int  line,
const char *  ptr_name 
)

Definition at line 29 of file u_calloc.c.

29  {
30 
31  /* allocating num elements of size bytes and initializing them to zero */
32 
33  void *a;
34  char *env;
35 
36  if(num==0){
37  a=NULL;
38  return(a);
39  }
40 
41  a=calloc(num,size);
42  if(a==NULL){
43  printf("*ERROR in u_calloc: error allocating memory\n");
44  printf("variable=%s, file=%s, line=%d, num=%ld, size=%ld\n",ptr_name,file,line,num,size);
45  exit(16);
46  }
47  else {
48  if(log_realloc==-1) {
49  log_realloc=0;
50  env=getenv("CCX_LOG_ALLOC");
51  if(env) {log_realloc=atoi(env);}
52  }
53  if(log_realloc==1) {
54  printf("ALLOCATION of variable %s, file %s, line=%d, num=%ld, size=%ld, address= %ld\n",ptr_name,file,line,num,size,(long int)a);
55  }
56  return(a);
57  }
58 }
int log_realloc
Definition: u_calloc.c:23

Variable Documentation

int log_realloc =-1

Definition at line 23 of file u_calloc.c.

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