diff options
Diffstat (limited to 'src/protocol')
| -rw-r--r-- | src/protocol/pair/pair.c | 6 | ||||
| -rw-r--r-- | src/protocol/reqrep/rep.c | 10 | ||||
| -rw-r--r-- | src/protocol/reqrep/req.c | 10 |
3 files changed, 13 insertions, 13 deletions
diff --git a/src/protocol/pair/pair.c b/src/protocol/pair/pair.c index 9336af8c..6ca891f0 100644 --- a/src/protocol/pair/pair.c +++ b/src/protocol/pair/pair.c @@ -47,11 +47,11 @@ nni_pair_create(void **pairp, nni_socket *sock) nni_pair_sock *pair; int rv; - if ((pair = nni_alloc(sizeof (*pair))) == NULL) { + if ((pair = NNI_ALLOC_STRUCT(pair)) == NULL) { return (NNG_ENOMEM); } if ((rv = nni_mtx_init(&pair->mx)) != 0) { - nni_free(pair, sizeof (*pair)); + NNI_FREE_STRUCT(pair); return (rv); } pair->sock = sock; @@ -73,7 +73,7 @@ nni_pair_destroy(void *arg) // the socket already shut us down, and we don't have any other // threads that run. nni_mtx_fini(&pair->mx); - nni_free(pair, sizeof (*pair)); + NNI_FREE_STRUCT(pair); } diff --git a/src/protocol/reqrep/rep.c b/src/protocol/reqrep/rep.c index 75cdaa2e..53007e12 100644 --- a/src/protocol/reqrep/rep.c +++ b/src/protocol/reqrep/rep.c @@ -51,11 +51,11 @@ nni_rep_create(void **repp, nni_socket *sock) nni_rep_sock *rep; int rv; - if ((rep = nni_alloc(sizeof (*rep))) == NULL) { + if ((rep = NNI_ALLOC_STRUCT(rep)) == NULL) { return (NNG_ENOMEM); } if ((rv = nni_mtx_init(&rep->mx)) != 0) { - nni_free(rep, sizeof (*rep)); + NNI_FREE_STRUCT(rep); return (rv); } rep->ttl = 8; // Per RFC @@ -65,7 +65,7 @@ nni_rep_create(void **repp, nni_socket *sock) rep->btrace_len = 0; if ((rv = nni_idhash_create(&rep->pipes)) != 0) { nni_mtx_fini(&rep->mx); - nni_free(rep, sizeof (*rep)); + NNI_FREE_STRUCT(rep); return (rv); } @@ -76,7 +76,7 @@ nni_rep_create(void **repp, nni_socket *sock) if (rv != 0) { nni_idhash_destroy(rep->pipes); nni_mtx_fini(&rep->mx); - nni_free(rep, sizeof (*rep)); + NNI_FREE_STRUCT(rep); return (rv); } *repp = rep; @@ -97,7 +97,7 @@ nni_rep_destroy(void *arg) if (rep->btrace != NULL) { nni_free(rep->btrace, rep->btrace_len); } - nni_free(rep, sizeof (*rep)); + NNI_FREE_STRUCT(rep); } diff --git a/src/protocol/reqrep/req.c b/src/protocol/reqrep/req.c index 611baadb..6c8f8543 100644 --- a/src/protocol/reqrep/req.c +++ b/src/protocol/reqrep/req.c @@ -55,16 +55,16 @@ nni_req_create(void **reqp, nni_socket *sock) nni_req_sock *req; int rv; - if ((req = nni_alloc(sizeof (*req))) == NULL) { + if ((req = NNI_ALLOC_STRUCT(req)) == NULL) { return (NNG_ENOMEM); } if ((rv = nni_mtx_init(&req->mx)) != 0) { - nni_free(req, sizeof (*req)); + NNI_FREE_STRUCT(req); return (rv); } if ((rv = nni_cv_init(&req->cv, &req->mx)) != 0) { nni_mtx_fini(&req->mx); - nni_free(req, sizeof (*req)); + NNI_FREE_STRUCT(req); return (rv); } // this is "semi random" start for request IDs. @@ -84,7 +84,7 @@ nni_req_create(void **reqp, nni_socket *sock) if (rv != 0) { nni_cv_fini(&req->cv); nni_mtx_fini(&req->mx); - nni_free(req, sizeof (*req)); + NNI_FREE_STRUCT(req); return (rv); } nni_thr_run(&req->resender); @@ -107,7 +107,7 @@ nni_req_destroy(void *arg) nni_thr_fini(&req->resender); nni_cv_fini(&req->cv); nni_mtx_fini(&req->mx); - nni_free(req, sizeof (*req)); + NNI_FREE_STRUCT(req); } |
