From 4c321bbaa56eed6d03d6d41e2726ee8ec492516b Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Sun, 22 Oct 2023 09:39:21 +0200 Subject: [PATCH 1/3] fix: use ifdef for NNG_ENABLE_STATS In some places, we use ifdef, and others if. This normalizes for always using ifdef, so we can compile when this macro is not defined. --- src/core/dialer.c | 2 +- src/core/listener.c | 2 +- src/core/pipe.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/dialer.c b/src/core/dialer.c index 7dd018f6a..55a46efb3 100644 --- a/src/core/dialer.c +++ b/src/core/dialer.c @@ -46,7 +46,7 @@ nni_dialer_destroy(nni_dialer *d) NNI_FREE_STRUCT(d); } -#if NNG_ENABLE_STATS +#ifdef NNG_ENABLE_STATS static void dialer_stat_init(nni_dialer *d, nni_stat_item *item, const nni_stat_info *info) { diff --git a/src/core/listener.c b/src/core/listener.c index 80aa17d75..7d3e3e0d4 100644 --- a/src/core/listener.c +++ b/src/core/listener.c @@ -491,7 +491,7 @@ nni_listener_getopt( void nni_listener_add_stat(nni_listener *l, nni_stat_item *item) { -#if NNG_ENABLE_STATS +#ifdef NNG_ENABLE_STATS nni_stat_add(&l->st_root, item); #else NNI_ARG_UNUSED(l); diff --git a/src/core/pipe.c b/src/core/pipe.c index 06a57bf59..58267d694 100644 --- a/src/core/pipe.c +++ b/src/core/pipe.c @@ -312,7 +312,7 @@ nni_pipe_create_listener(nni_pipe **pp, nni_listener *l, void *tran_data) return (rv); } p->p_listener = l; -#if NNG_ENABLE_STATS +#ifdef NNG_ENABLE_STATS static const nni_stat_info listener_info = { .si_name = "listener", .si_desc = "listener for pipe", From d2aa59d7bf53c104e5437415f5c827ecc64b36ca Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Sun, 22 Oct 2023 09:41:20 +0200 Subject: [PATCH 2/3] fix: use ifdef for NNG_TEST_LIB In some places, we use ifdef, and others if. This normalizes for always using ifdef, so we can compile when this macro is not defined. --- src/sp/protocol/pair1/pair.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sp/protocol/pair1/pair.c b/src/sp/protocol/pair1/pair.c index e98e1ed91..401d70d59 100644 --- a/src/sp/protocol/pair1/pair.c +++ b/src/sp/protocol/pair1/pair.c @@ -498,7 +498,7 @@ pair1_pipe_send(pair1_pipe *p, nni_msg *m) // assumption: we have unique access to the message at this point. NNI_ASSERT(!nni_msg_shared(m)); -#if NNG_TEST_LIB +#ifdef NNG_TEST_LIB if (s->inject_header) { goto inject; } @@ -506,7 +506,7 @@ pair1_pipe_send(pair1_pipe *p, nni_msg *m) NNI_ASSERT(nni_msg_header_len(m) == sizeof(uint32_t)); nni_msg_header_poke_u32(m, nni_msg_header_peek_u32(m) + 1); -#if NNG_TEST_LIB +#ifdef NNG_TEST_LIB inject: #endif @@ -531,7 +531,7 @@ pair1_sock_send(void *arg, nni_aio *aio) return; } -#if NNG_TEST_LIB +#ifdef NNG_TEST_LIB if (s->inject_header) { goto inject; } @@ -554,7 +554,7 @@ pair1_sock_send(void *arg, nni_aio *aio) nni_msg_header_append_u32(m, 0); } -#if NNG_TEST_LIB +#ifdef NNG_TEST_LIB inject: #endif From 250e6f1f64df6652092244f2162adf06341505ed Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Sun, 22 Oct 2023 09:42:17 +0200 Subject: [PATCH 3/3] fix: use ifdef for NNG_HAVE_BACKTRACE In some places, we use ifdef, and others if. This normalizes for always using ifdef, so we can compile when this macro is not defined. --- src/core/panic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/panic.c b/src/core/panic.c index d50664cfd..f18c0d9e0 100644 --- a/src/core/panic.c +++ b/src/core/panic.c @@ -23,7 +23,7 @@ void nni_show_backtrace(void) { -#if NNG_HAVE_BACKTRACE +#ifdef NNG_HAVE_BACKTRACE void *frames[50]; int nframes;