diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-01-02 11:26:43 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-01-02 11:26:43 -0800 |
| commit | c3d8e75f2bb76b5bfafc589f860036cf42cfbaa0 (patch) | |
| tree | 44c6cf24785864b4b83adb0fad9ec2b51f67d862 /src/protocol/reqrep/rep.c | |
| parent | b921ef8889a86cce42bca28950e33ba11d28d78f (diff) | |
| download | nng-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/rep.c')
| -rw-r--r-- | src/protocol/reqrep/rep.c | 10 |
1 files changed, 5 insertions, 5 deletions
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); } |
