root/src/u_free.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. u_free

   1 
   2 /*     CalculiX - A 3-dimensional finite element program                   */
   3 /*              Copyright (C) 1998-2015 Guido Dhondt                          */
   4 
   5 /*     This program is free software; you can redistribute it and/or     */
   6 /*     modify it under the terms of the GNU General Public License as    */
   7 /*     published by the Free Software Foundation(version 2);    */
   8 /*                    */
   9 
  10 /*     This program is distributed in the hope that it will be useful,   */
  11 /*     but WITHOUT ANY WARRANTY; without even the implied warranty of    */ 
  12 /*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the      */
  13 /*     GNU General Public License for more details.                      */
  14 
  15 /*     You should have received a copy of the GNU General Public License */
  16 /*     along with this program; if not, write to the Free Software       */
  17 /*     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.         */
  18 
  19 #include <stdio.h>
  20 #include <stdlib.h>
  21 #include "CalculiX.h"
  22 extern int log_realloc;
  23 
  24 /*
  25  Diehl program
  26 */
  27 
  28 void *u_free(void* ptr,const char *file,const int line, const char* ptr_name){
  29 
  30     /* freeing a field with pointer ptr  */
  31 
  32   char *env;
  33 
  34   free(ptr);
  35 
  36   if(log_realloc==-1) {
  37       log_realloc=0;
  38       env=getenv("CCX_LOG_ALLOC");
  39       if(env) {log_realloc=atoi(env);}
  40   }      
  41   if(log_realloc==1) {
  42       printf("FREEING of variable %s, file %s, line=%d: oldaddress= %ld\n",ptr_name,file,line,(long int)ptr);
  43   }      
  44   return;
  45 }

/* [<][>][^][v][top][bottom][index][help] */