Skip to content

Commit

Permalink
replace built-in assert with own CHECK macro (#2938)
Browse files Browse the repository at this point in the history
  • Loading branch information
StrikerRUS authored Apr 3, 2020
1 parent 51f37e9 commit cc6a2f5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/io/json11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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.
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit cc6a2f5

Please sign in to comment.