#include "host.h"
#include "callcpp.h"
Go to the source code of this file.
#define ILLEGALMALLOCREQUEST 2001 |
#define NOTENOUGHMEMORY 2000 |
void Efree | ( | void * | ptr | ) |
Attempts to free the specified pointer.
ptr | Pointer to allocated memory |
Definition at line 90 of file emalloc.cpp.
References DoError(), ILLEGALMALLOCREQUEST, and NULL.
Referenced by EndDangerousAmbigs(), free_adapted_class(), free_adapted_templates(), free_int_class(), free_int_templates(), FreeCharDescription(), FreeMicroFeatures(), FreeNormProtos(), and LogNewWordChoice().
00090 { 00091 if (ptr == NULL) 00092 DoError (ILLEGALMALLOCREQUEST, "Attempted to free NULL ptr"); 00093 00094 free(ptr); 00095 00096 } /* Efree */
void* Emalloc | ( | size_t | Size | ) |
Attempts to allocate the specified number of bytes.
Size | Number of bytes of memory to be allocated |
Definition at line 45 of file emalloc.cpp.
References DoError(), ILLEGALMALLOCREQUEST, NOTENOUGHMEMORY, and NULL.
Referenced by AddIntClass(), AddIntProto(), ComputeStatistics(), CreateClusterTree(), FillAmbigTable(), GetAmbiguities(), MakeBuckets(), MakeClusterer(), MakeHeap(), MakeKDNode(), MakeKDTree(), MakeNewCluster(), MakeSample(), MultipleCharSamples(), NewAdaptedClass(), NewAdaptedTemplates(), NewBitVector(), NewCharDescription(), NewChiStruct(), NewClass(), NewEllipticalProto(), NewFeatureSet(), NewIntClass(), NewIntTemplates(), NewLabeledClass(), NewLabeledList(), NewMicroFeature(), NewMixedProto(), NewSignalMenuItem(), NewSimpleProto(), NewViableChoice(), ReadAdaptedClass(), ReadAdaptedTemplates(), ReadConfigs(), ReadIntTemplates(), ReadNFloats(), ReadNormProtos(), ReadParamDesc(), ReadPermConfig(), ReadProtos(), ReadPrototype(), RemoveInsignificantProtos(), SetUpForClustering(), SetUpForFloat2Int(), and TestEllipticalProto().
00045 { 00046 void *Buffer; 00047 00048 if (Size <= 0) 00049 DoError (ILLEGALMALLOCREQUEST, "Illegal malloc request size"); 00050 Buffer = (void *) malloc (Size); 00051 if (Buffer == NULL) { 00052 DoError (NOTENOUGHMEMORY, "Not enough memory"); 00053 return (NULL); 00054 } 00055 else 00056 return (Buffer); 00057 00058 } /* Emalloc */
void* Erealloc | ( | void * | ptr, | |
size_t | size | |||
) |
Attempts to reallocate the specified number of bytes.
ptr | Pointer to allocated memory | |
size | Number of bytes of memory to be reallocated |
Definition at line 69 of file emalloc.cpp.
References DoError(), ILLEGALMALLOCREQUEST, NOTENOUGHMEMORY, and NULL.
Referenced by AddConfigToClass(), AddIntProto(), AddProtoToClass(), and ExpandBitVector().
00069 { 00070 void *Buffer; 00071 00072 if (size < 0 || (size == 0 && ptr == NULL)) 00073 DoError (ILLEGALMALLOCREQUEST, "Illegal realloc request size"); 00074 00075 Buffer = (void *) realloc (ptr, size); 00076 if (Buffer == NULL && size != 0) 00077 DoError (NOTENOUGHMEMORY, "Not enough memory"); 00078 return (Buffer); 00079 00080 } /* Erealloc */