diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-02-14 14:50:04 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-02-14 18:28:36 -0800 |
| commit | 45bc175ef9278c175d2fc3a0678b49b18e74c449 (patch) | |
| tree | b1838778ee898112f28b35178364068c6f48c9b4 /src/core/aio.c | |
| parent | 8f93750ed2a6aaa1749eb689ddf119280f9aac7a (diff) | |
| download | nng-45bc175ef9278c175d2fc3a0678b49b18e74c449.tar.gz nng-45bc175ef9278c175d2fc3a0678b49b18e74c449.tar.bz2 nng-45bc175ef9278c175d2fc3a0678b49b18e74c449.zip | |
fixes #234 Investigate enabling more verbose compiler warnings
We enabled verbose compiler warnings, and found a lot of issues.
Some of these were even real bugs. As a bonus, we actually save
some initialization steps in the compat layer, and avoid passing
some variables we don't need.
Diffstat (limited to 'src/core/aio.c')
| -rw-r--r-- | src/core/aio.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/core/aio.c b/src/core/aio.c index 1c293020..dd5edf0e 100644 --- a/src/core/aio.c +++ b/src/core/aio.c @@ -215,51 +215,51 @@ nni_aio_get_msg(nni_aio *aio) } void -nni_aio_set_data(nni_aio *aio, int index, void *data) +nni_aio_set_data(nni_aio *aio, unsigned index, void *data) { - if ((index >= 0) && (index < NNI_NUM_ELEMENTS(aio->a_user_data))) { + if (index < NNI_NUM_ELEMENTS(aio->a_user_data)) { aio->a_user_data[index] = data; } } void * -nni_aio_get_data(nni_aio *aio, int index) +nni_aio_get_data(nni_aio *aio, unsigned index) { - if ((index >= 0) && (index < NNI_NUM_ELEMENTS(aio->a_user_data))) { + if (index < NNI_NUM_ELEMENTS(aio->a_user_data)) { return (aio->a_user_data[index]); } return (NULL); } void -nni_aio_set_input(nni_aio *aio, int index, void *data) +nni_aio_set_input(nni_aio *aio, unsigned index, void *data) { - if ((index >= 0) && (index < NNI_NUM_ELEMENTS(aio->a_inputs))) { + if (index < NNI_NUM_ELEMENTS(aio->a_inputs)) { aio->a_inputs[index] = data; } } void * -nni_aio_get_input(nni_aio *aio, int index) +nni_aio_get_input(nni_aio *aio, unsigned index) { - if ((index >= 0) && (index < NNI_NUM_ELEMENTS(aio->a_inputs))) { + if (index < NNI_NUM_ELEMENTS(aio->a_inputs)) { return (aio->a_inputs[index]); } return (NULL); } void -nni_aio_set_output(nni_aio *aio, int index, void *data) +nni_aio_set_output(nni_aio *aio, unsigned index, void *data) { - if ((index >= 0) && (index < NNI_NUM_ELEMENTS(aio->a_outputs))) { + if (index < NNI_NUM_ELEMENTS(aio->a_outputs)) { aio->a_outputs[index] = data; } } void * -nni_aio_get_output(nni_aio *aio, int index) +nni_aio_get_output(nni_aio *aio, unsigned index) { - if ((index >= 0) && (index < NNI_NUM_ELEMENTS(aio->a_outputs))) { + if (index < NNI_NUM_ELEMENTS(aio->a_outputs)) { return (aio->a_outputs[index]); } return (NULL); @@ -315,7 +315,7 @@ nni_aio_start(nni_aio *aio, nni_aio_cancelfn cancelfn, void *data) aio->a_prov_cancel = cancelfn; aio->a_prov_data = data; aio->a_active = 1; - for (int i = 0; i < NNI_NUM_ELEMENTS(aio->a_outputs); i++) { + for (unsigned i = 0; i < NNI_NUM_ELEMENTS(aio->a_outputs); i++) { aio->a_outputs[i] = NULL; } |
