aboutsummaryrefslogtreecommitdiff
path: root/src/protocol/reqrep/req.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-02 11:26:43 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-02 11:26:43 -0800
commitc3d8e75f2bb76b5bfafc589f860036cf42cfbaa0 (patch)
tree44c6cf24785864b4b83adb0fad9ec2b51f67d862 /src/protocol/reqrep/req.c
parentb921ef8889a86cce42bca28950e33ba11d28d78f (diff)
downloadnng-c3d8e75f2bb76b5bfafc589f860036cf42cfbaa0.tar.gz
nng-c3d8e75f2bb76b5bfafc589f860036cf42cfbaa0.tar.bz2
nng-c3d8e75f2bb76b5bfafc589f860036cf42cfbaa0.zip
Use new NNI_ALLOC_STRUCT macro. nni_msg_dup copies options too.
Diffstat (limited to 'src/protocol/reqrep/req.c')
-rw-r--r--src/protocol/reqrep/req.c10
1 files changed, 5 insertions, 5 deletions
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);
}