Skip to content

Commit 68d4017

Browse files
committed
Cleanup.
1 parent e6873be commit 68d4017

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

include/xgboost/c_api.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,21 +1333,23 @@ XGB_DLL int XGBoosterPredictFromCudaColumnar(BoosterHandle handle, char const *d
13331333
* @{
13341334
*/
13351335

1336-
/*!
1337-
* \brief Load model from existing file
1336+
/**
1337+
* @brief Load the model from an existing file
13381338
*
1339-
* \param handle handle
1340-
* \param fname File URI or file name. The string must be UTF-8 encoded.
1341-
* \return 0 when success, -1 when failure happens
1339+
* @param handle handle
1340+
* @param fname File name. The string must be UTF-8 encoded.
1341+
*
1342+
* @return 0 when success, -1 when failure happens
13421343
*/
13431344
XGB_DLL int XGBoosterLoadModel(BoosterHandle handle,
13441345
const char *fname);
1345-
/*!
1346-
* \brief Save model into existing file
1346+
/**
1347+
* @brief Save the model into an existing file
13471348
*
1348-
* \param handle handle
1349-
* \param fname File URI or file name. The string must be UTF-8 encoded.
1350-
* \return 0 when success, -1 when failure happens
1349+
* @param handle handle
1350+
* @param fname File name. The string must be UTF-8 encoded.
1351+
*
1352+
* @return 0 when success, -1 when failure happens
13511353
*/
13521354
XGB_DLL int XGBoosterSaveModel(BoosterHandle handle,
13531355
const char *fname);

src/c_api/c_api.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,9 +1493,10 @@ XGB_DLL int XGBoosterSaveModel(BoosterHandle handle, const char *fname) {
14931493
Json::Dump(out, &str, mode);
14941494
fo->Write(str.data(), str.size());
14951495
};
1496-
if (common::FileExtension(fname) == "json") {
1496+
auto ext = common::FileExtension(fname);
1497+
if (ext == "json") {
14971498
save_json(std::ios::out);
1498-
} else if (common::FileExtension(fname) == "ubj") {
1499+
} else if (ext == "ubj") {
14991500
save_json(std::ios::binary);
15001501
} else {
15011502
LOG(WARNING) << "Saving model in the UBJSON format as default. You can use file extension:"

0 commit comments

Comments
 (0)