Logo Search packages:      
Sourcecode: edfbrowser version File versions  Download package

s_calloc.c

/*
***************************************************************************
*
* Author: Teunis van Beelen
*
* Copyright (C) 2009 Teunis van Beelen
*
* teuniz@gmail.com
*
***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
***************************************************************************
*
* This version of GPL is at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
*
***************************************************************************
*/




#include "s_calloc.h"



// #define PNTR_LIST_SIZE 2048
//
//
//
//
// void *pntr_list[PNTR_LIST_SIZE];
//
// static int calloc_cnt;
//
// void clear_s_calloc_pointer_list(void)
// {
//   int i;
//
//   for(i=0; i<PNTR_LIST_SIZE; i++)
//   {
//     pntr_list[i] = NULL;
//   }
//
//   calloc_cnt = 0;
// }
//
// void * s_calloc(size_t nmemb, size_t size)
// {
//   int i;
//
//   void *pntr;
//
//   pntr = calloc(nmemb, size);
//
//   if(pntr!=NULL)
//   {
//     for(i=0; i<PNTR_LIST_SIZE; i++)
//     {
//       if(pntr_list[i]==NULL)
//       {
//         pntr_list[i] = pntr;
//
//         printf("allocating nr %i,    %i pntr's unfreed\n", i, ++calloc_cnt);
//
//         return(pntr);
//       }
//     }
//
//     printf("pointerlist too small\n");
//   }
//
//   return(pntr);
// }
//
// void s_free(void *pntr)
// {
//   int i;
//
//   if(pntr==NULL)
//   {
//     printf("free-ing a NULL-pointer\n");
//   }
//   else
//   {
//     for(i=0; i<PNTR_LIST_SIZE; i++)
//     {
//       if(pntr_list[i]==pntr)
//       {
//         pntr_list[i] = NULL;
//
//         printf("freeing    nr %i,    %i pntr's unfreed\n", i, --calloc_cnt);
//
//         break;
//       }
//     }
//
//     if(i==PNTR_LIST_SIZE)
//     {
//       printf("free-ing an unidentified-pointer\n");
//     }
//   }
//
//   free(pntr);
// }




void clear_s_calloc_pointer_list(void)
{
}

void * s_calloc(size_t nmemb, size_t size)
{
  return(calloc(nmemb, size));
}

void s_free(void *pntr)
{
  free(pntr);
}









Generated by  Doxygen 1.6.0   Back to index