Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve '-Wzero-as-null-pointer-constant' warning #157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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