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 @@ ...@@ -20,13 +20,12 @@
*/ */
#include <LightGBM/utils/json11.h> #include <LightGBM/utils/json11.h>
#include <limits> #include <LightGBM/utils/log.h>
#ifndef LGB_R_BUILD
#include <cassert>
#endif
#include <cmath> #include <cmath>
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <limits>
namespace json11 { namespace json11 {
...@@ -39,6 +38,8 @@ using std::make_shared; ...@@ -39,6 +38,8 @@ using std::make_shared;
using std::initializer_list; using std::initializer_list;
using std::move; using std::move;
using LightGBM::Log;
/* Helper for representing null - just a do-nothing struct, plus comparison /* 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 * operators so the helpers in JsonValue work. We can't use nullptr_t because
* it may not be orderable. * it may not be orderable.
...@@ -626,9 +627,7 @@ struct JsonParser final { ...@@ -626,9 +627,7 @@ struct JsonParser final {
* the input and return res. If not, flag an error. * the input and return res. If not, flag an error.
*/ */
Json expect(const string &expected, Json res) { Json expect(const string &expected, Json res) {
#ifndef LGB_R_BUILD CHECK_NE(i, 0)
assert(i != 0);
#endif
i--; i--;
if (str.compare(i, expected.length(), expected) == 0) { if (str.compare(i, expected.length(), expected) == 0) {
i += expected.length(); 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