checkin
This commit is contained in:
parent
fd26f45208
commit
46342d4633
@ -11,7 +11,7 @@
|
||||
#ifdef _MSC_VER
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
#include "../xgboost/utils.h"
|
||||
#include "./utils.h"
|
||||
namespace xgboost {
|
||||
namespace utils {
|
||||
/*! \brief simple semaphore used for synchronization */
|
||||
|
||||
@ -134,9 +134,11 @@ using namespace xgboost::wrapper;
|
||||
* \brief every function starts with API_BEGIN(); and finishes with API_END();
|
||||
* \param Finalize optionally put in a finalizer
|
||||
*/
|
||||
#define API_END(Finalize) } catch(std::exception &e) { \
|
||||
#define API_END_FINALIZE(Finalize) } catch(std::exception &e) { \
|
||||
Finalize; return XGBHandleException(e); \
|
||||
} return 0;
|
||||
/*! \brief API End with no finalization */
|
||||
#define API_END() API_END_FINALIZE(;)
|
||||
|
||||
// do not use threadlocal on OSX since it is not always available
|
||||
#ifndef DISABLE_THREAD_LOCAL
|
||||
@ -217,7 +219,7 @@ int XGDMatrixCreateFromCSR(const bst_ulong *indptr,
|
||||
}
|
||||
mat.info.info.num_row = nindptr - 1;
|
||||
*out = p_mat;
|
||||
API_END(delete p_mat);
|
||||
API_END_FINALIZE(delete p_mat);
|
||||
}
|
||||
|
||||
int XGDMatrixCreateFromCSC(const bst_ulong *col_ptr,
|
||||
@ -258,7 +260,7 @@ int XGDMatrixCreateFromCSC(const bst_ulong *col_ptr,
|
||||
mat.info.info.num_row = mat.row_ptr_.size() - 1;
|
||||
mat.info.info.num_col = static_cast<size_t>(ncol);
|
||||
*out = p_mat;
|
||||
API_END(delete p_mat);
|
||||
API_END_FINALIZE(delete p_mat);
|
||||
}
|
||||
|
||||
int XGDMatrixCreateFromMat(const float *data,
|
||||
@ -289,7 +291,7 @@ int XGDMatrixCreateFromMat(const float *data,
|
||||
mat.row_ptr_.push_back(mat.row_ptr_.back() + nelem);
|
||||
}
|
||||
*out = p_mat;
|
||||
API_END(delete p_mat);
|
||||
API_END_FINALIZE(delete p_mat);
|
||||
}
|
||||
|
||||
int XGDMatrixSliceDMatrix(DMatrixHandle handle,
|
||||
@ -340,7 +342,7 @@ int XGDMatrixSliceDMatrix(DMatrixHandle handle,
|
||||
}
|
||||
}
|
||||
*out = p_ret;
|
||||
API_END(delete p_ret);
|
||||
API_END_FINALIZE(delete p_ret);
|
||||
}
|
||||
|
||||
int XGDMatrixFree(DMatrixHandle handle) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user