Exemple #1
0
void *sREALLOC(char *name,unsigned long line,void *ptr,size_t size)
{
	void *malloc_ptr;

	malloc_ptr=realloc(ptr,size);
#ifdef MALLOC_DEBUG
	malloc_log("lirealloc:%p:%d:%s:%d\n", (unsigned) ptr, 0, name, line);
	malloc_log("lirealloc:%p:%d:%s:%d\n", (unsigned) malloc_ptr, size, name, line);
#endif
	return(malloc_ptr);
}
/* Initialize the msgtab parsing tree -orabidoo
 */
void init_tree_parse(struct Message *mptr)
{
  int i;
  struct Message *mpt = mptr;

  for (i=0; mpt->cmd; mpt++)
    i++;
  qsort((void *)mptr, i, sizeof(struct Message), 
                (int (*)(const void *, const void *)) mcmp);
  expect_malloc;
  msg_tree_root = (MESSAGE_TREE *)MyMalloc(sizeof(MESSAGE_TREE));
  malloc_log("init_tree_parse() allocating MESSAGE_TREE (%zd bytes) at %p",
             sizeof(MESSAGE_TREE), (void *)msg_tree_root);
  mpt = do_msg_tree(msg_tree_root, "", mptr);

  /*
   * this happens if one of the msgtab entries included characters
   * other than capital letters  -orabidoo
   */
  if (mpt->cmd)
    {
      logprintf(L_CRIT, "bad msgtab entry: ``%s''\n", mpt->cmd);
      exit(1);
    }
}
Exemple #3
0
void *sFREE(char *name,unsigned long line,void *ptr)
{
#ifdef MALLOC_DEBUG
	malloc_log("lifree:%p:0:%s:%d\n", (unsigned) ptr, name, line);
#endif
	free(ptr);
	return (NULL);
}
void operator delete[] (void *p) {
    void *f = (void *)((unsigned int)p - sizeof(int));
    if(*(int*)f != ARRAY_MAGIC)
    {
        malloc_log("delete[] error!");
    }
    free(f);
}                  
Exemple #5
0
void *sCALLOC(char *name,unsigned long line,size_t size1,size_t size2)
{
	void *malloc_ptr;
	unsigned long size=size1*size2;

	malloc_ptr=malloc(size);
#ifdef MALLOC_DEBUG
	malloc_log("licalloc:%p:%d:%s:%d\n", (unsigned) malloc_ptr, size1 * size2, name, line);
#endif
	return(malloc_ptr);
}
static void clear_channel_hash_table(void)
{
#ifdef        DEBUGMODE
  chmiss = 0;
  chhits = 0;
  if (!channelTable)
    {
      expect_malloc;
      channelTable = (struct HashEntry*) MyMalloc(CH_MAX *
                                                  sizeof(struct HashEntry));
      malloc_log("clear_channel_hash_table() allocating %d struct HashEntrys (%zd bytes) at %p",
                 CH_MAX, CH_MAX * sizeof(struct HashEntry), channelTable);
    }
#endif
  memset(channelTable, 0, sizeof(struct HashEntry) * CH_MAX);
}
/*
 * clear_client_hash_table
 *
 * Nullify the hashtable and its contents so it is completely empty.
 */
static void clear_client_hash_table(void)
{
#ifdef        DEBUGMODE
  clhits = 0;
  clmiss = 0;
  if(!clientTable)
    {
      expect_malloc;
      clientTable = (struct HashEntry*) MyMalloc(U_MAX * 
                                                 sizeof(struct HashEntry));
      malloc_log("clear_client_hash_table() allocating %d struct HashEntrys (%zd bytes) at %p",
                 U_MAX, U_MAX * sizeof(struct HashEntry), clientTable);
    }
#endif
  memset(clientTable, 0, sizeof(struct HashEntry) * U_MAX);
}