cutil/freelist.h File Reference

#include <stdio.h>

Go to the source code of this file.

Functions


Function Documentation

void mem_tidy ( int  level  ) 

Do nothing.

Definition at line 76 of file freelist.cpp.

References c_check_mem().

Referenced by AddNewChunk().

00076                          {
00077   c_check_mem ("Old tidy", level);
00078 }

int* memalloc ( int  size  ) 

Memory allocator with protection.

Definition at line 37 of file freelist.cpp.

References c_alloc_mem(), and mem_alloc_counter.

Referenced by array_new(), bin_to_chunks(), blobs_widths(), create_matrix(), init_match_table(), init_permdawg(), init_permute(), new_hash_table(), new_search(), new_tally(), record_blob_bounds(), replace_char_widths(), and state_char_widths().

00037                         {
00038   mem_alloc_counter++;
00039   return ((int *) c_alloc_mem (size));
00040 }

int* memalloc_p ( int  size  ) 

Memory allocator with protection.

Definition at line 26 of file freelist.cpp.

References c_alloc_mem_p(), DoError(), and mem_alloc_counter.

00026                           {
00027   mem_alloc_counter++;
00028   if (!size)
00029     DoError (0, "Allocation of 0 bytes");
00030   return ((int *) c_alloc_mem_p (size));
00031 }

void memfree ( void *  element  ) 

Memory allocator with protection.

Definition at line 61 of file freelist.cpp.

References c_free_mem(), cprintf(), DoError(), and mem_alloc_counter.

Referenced by classify_piece(), CleanUpUnusedData(), ComputeStatistics(), CreateClusterTree(), delete_search(), destroy_nodes(), end_match_table(), end_metrics(), end_permdawg(), end_permute(), evaluate_state(), free_matrix(), free_outline(), FreeBadChoice(), FreeBitVector(), FreeClass(), FreeClassFields(), FreeCluster(), FreeClusterer(), FreeFeatureSet(), FreeKDNode(), FreeKDTree(), FreePrototype(), FreeStatistics(), FreeSubTree(), FreeTempConfig(), InitChoiceAccum(), LogNewRawChoice(), MakeKDTree(), MultipleCharSamples(), rebuild_current_state(), record_piece_ratings(), save_best_state(), TestEllipticalProto(), and width_priority().

00061                             {
00062   if (element) {
00063     c_free_mem(element);
00064     mem_alloc_counter--;
00065   }
00066   else {
00067     cprintf ("%d MEM_ALLOC's used\n", mem_alloc_counter);
00068     DoError (0, "Memfree of NULL pointer");
00069   }
00070 }

int* memrealloc ( void *  ptr,
int  size,
int  oldsize 
)

Memory allocator with protection.

Definition at line 46 of file freelist.cpp.

References c_alloc_mem(), and c_free_mem().

Referenced by array_push().

00046                                                   {
00047   int shiftsize;
00048   int *newbuf;
00049 
00050   shiftsize = size > oldsize ? oldsize : size;
00051   newbuf = (int *) c_alloc_mem (size);
00052   memcpy(newbuf, ptr, shiftsize);
00053   c_free_mem(ptr);
00054   return newbuf;
00055 }


Generated on Wed Feb 28 19:49:21 2007 for Tesseract by  doxygen 1.5.1