Unverified Commit cc6a2f5a authored by Nikita Titov's avatar Nikita Titov Committed by GitHub
Browse files

replace built-in assert with own CHECK macro (#2938)

parent 51f37e9b
......@@ -20,13 +20,12 @@
*/
#include <LightGBM/utils/json11.h>
#include <limits>
#ifndef LGB_R_BUILD
#include <cassert>
#endif
#include <LightGBM/utils/log.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <limits>
namespace json11 {
......@@ -39,6 +38,8 @@ using std::make_shared;
using std::initializer_list;
using std::move;
using LightGBM::Log;
/* Helper for representing null - just a do-nothing struct, plus comparison
* operators so the helpers in JsonValue work. We can't use nullptr_t because
* it may not be orderable.
......@@ -626,9 +627,7 @@ struct JsonParser final {
* the input and return res. If not, flag an error.
*/
Json expect(const string &expected, Json res) {
#ifndef LGB_R_BUILD
assert(i != 0);
#endif
CHECK_NE(i, 0)
i--;
if (str.compare(i, expected.length(), expected) == 0) {
i += expected.length();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment