replaced alloca() (a.k.a. cvStackAlloc) with AutoBuffer or vector() everywhere. cvStackAlloc() is still defined, but we do not need alloca() anymore to compile and run OpenCV (fixes #889 and may be some others)

This commit is contained in:
Vadim Pisarevsky
2011-02-18 10:36:18 +00:00
parent 0e81d9a11c
commit c5e3869c32
3 changed files with 7 additions and 6 deletions

View File

@@ -646,7 +646,8 @@ float CvRTrees::predict( const CvMat* sample, const CvMat* missing ) const
if( nclasses > 0 ) //classification
{
int max_nvotes = 0;
int* votes = (int*)alloca( sizeof(int)*nclasses );
cv::AutoBuffer<int> _votes(nclasses);
int* votes = _votes;
memset( votes, 0, sizeof(*votes)*nclasses );
for( k = 0; k < ntrees; k++ )
{
@@ -682,7 +683,8 @@ float CvRTrees::predict_prob( const CvMat* sample, const CvMat* missing) const
if( nclasses == 2 ) //classification
{
int max_nvotes = 0;
int* votes = (int*)alloca( sizeof(int)*nclasses );
cv::AutoBuffer<int> _votes(nclasses);
int* votes = _votes;
memset( votes, 0, sizeof(*votes)*nclasses );
for( k = 0; k < ntrees; k++ )
{