CalculiX  2.13
A Free Software Three-Dimensional Structural Finite Element Program
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

◆ u_calloc()

void* u_calloc ( size_t  num,
size_t  size,
const char *  file,
const int  line,
const char *  ptr_name 
)
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  if(num<0){
46  printf("\n It looks like you may need the i8 (integer*8) version of CalculiX\n");
47  }
48  exit(16);
49  }
50  else {
51  if(log_realloc==-1) {
52  log_realloc=0;
53  env=getenv("CCX_LOG_ALLOC");
54  if(env) {log_realloc=atoi(env);}
55  }
56  if(log_realloc==1) {
57  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);
58  }
59  return(a);
60  }
61 }
int log_realloc
Definition: u_calloc.c:23

Variable Documentation

◆ log_realloc

int log_realloc =-1
Hosted by OpenAircraft.com, (Michigan UAV, LLC)