diff options
| author | Garrett D'Amore <garrett@damore.org> | 2021-12-25 13:14:26 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2021-12-25 13:14:26 -0800 |
| commit | 57e5c8bb2ee122c30fa14127c3b969dc858491c0 (patch) | |
| tree | 7c95640e8360c3d67d6967791b24a16b00414a5d /src/core/pollable.c | |
| parent | beb8eb05310ac945ede357e2e57152f0d71e38ed (diff) | |
| download | nng-57e5c8bb2ee122c30fa14127c3b969dc858491c0.tar.gz nng-57e5c8bb2ee122c30fa14127c3b969dc858491c0.tar.bz2 nng-57e5c8bb2ee122c30fa14127c3b969dc858491c0.zip | |
Pollables can be completely inline.
This eliminates more failure paths, and brings us still closer
to eliminating the possibility of failure during socket init.
Diffstat (limited to 'src/core/pollable.c')
| -rw-r--r-- | src/core/pollable.c | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/src/core/pollable.c b/src/core/pollable.c index fb6af0f5..8e5ad7c1 100644 --- a/src/core/pollable.c +++ b/src/core/pollable.c @@ -1,5 +1,5 @@ // -// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2021 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a @@ -38,34 +38,9 @@ nni_pollable_fini(nni_pollable *p) } } -int -nni_pollable_alloc(nni_pollable **pp) -{ - nni_pollable *p; - if ((p = NNI_ALLOC_STRUCT(p)) == NULL) { - return (NNG_ENOMEM); - } - nni_pollable_init(p); - *pp = p; - return (0); -} - -void -nni_pollable_free(nni_pollable *p) -{ - if (p == NULL) { - return; - } - nni_pollable_fini(p); - NNI_FREE_STRUCT(p); -} - void nni_pollable_raise(nni_pollable *p) { - if (p == NULL) { - return; - } if (!nni_atomic_swap_bool(&p->p_raised, true)) { uint64_t fds; if ((fds = nni_atomic_get64(&p->p_fds)) != (uint64_t) -1) { @@ -77,9 +52,6 @@ nni_pollable_raise(nni_pollable *p) void nni_pollable_clear(nni_pollable *p) { - if (p == NULL) { - return; - } if (nni_atomic_swap_bool(&p->p_raised, false)) { uint64_t fds; if ((fds = nni_atomic_get64(&p->p_fds)) != (uint64_t) -1) { |
