Skip to content

Commit

Permalink
Resolve '-Wzero-as-null-pointer-constant' warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Minty-Meeo committed Mar 24, 2023
1 parent 111c9be commit 69d6fdf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
prefix=/usr/local
includedir=$(prefix)/include
CXX_FLAGS=-Wall -Wextra -Wzero-as-null-pointer-constant

check: test

Expand All @@ -8,10 +9,10 @@ test: test-core test-core-int64
./test-core-int64

test-core: picojson.h test.cc picotest/picotest.c picotest/picotest.h
$(CXX) -Wall test.cc picotest/picotest.c -o $@
$(CXX) $(CXX_FLAGS) test.cc picotest/picotest.c -o $@

test-core-int64: picojson.h test.cc picotest/picotest.c picotest/picotest.h
$(CXX) -Wall -DPICOJSON_USE_INT64 test.cc picotest/picotest.c -o $@
$(CXX) $(CXX_FLAGS) -DPICOJSON_USE_INT64 test.cc picotest/picotest.c -o $@

clean:
rm -f test-core test-core-int64
Expand Down
2 changes: 1 addition & 1 deletion examples/github-issues.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ typedef struct {

MEMFILE *memfopen() {
MEMFILE *mf = (MEMFILE *)malloc(sizeof(MEMFILE));
mf->data = NULL;
mf->data = nullptr;
mf->size = 0;
return mf;
}
Expand Down
2 changes: 1 addition & 1 deletion picojson.h
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ template <typename Iter> inline std::string parse(value &out, Iter &pos, const I

template <typename Context, typename Iter> inline Iter _parse(Context &ctx, const Iter &first, const Iter &last, std::string *err) {
input<Iter> in(first, last);
if (!_parse(ctx, in) && err != NULL) {
if (!_parse(ctx, in) && err != nullptr) {
char buf[64];
SNPRINTF(buf, sizeof(buf), "syntax error at line %d near: ", in.line());
*err = buf;
Expand Down

0 comments on commit 69d6fdf

Please sign in to comment.