diff options
| -rw-r--r-- | src/core/idhash.c | 3 | ||||
| -rw-r--r-- | tests/idhash.c | 2 | ||||
| -rw-r--r-- | tests/inproc.c | 1 | ||||
| -rw-r--r-- | tests/sock.c | 13 | ||||
| -rw-r--r-- | tests/stubs.h | 11 |
5 files changed, 14 insertions, 16 deletions
diff --git a/src/core/idhash.c b/src/core/idhash.c index 40d134a5..0b680bc9 100644 --- a/src/core/idhash.c +++ b/src/core/idhash.c @@ -34,7 +34,6 @@ int nni_idhash_create(nni_idhash **hp) { nni_idhash *h; - int rv; if ((h = NNI_ALLOC_STRUCT(h)) == NULL) { return (NNG_ENOMEM); @@ -258,7 +257,7 @@ nni_idhash_insert(nni_idhash *h, uint32_t id, void *val) int nni_idhash_alloc(nni_idhash *h, uint32_t *idp, void *val) { - uint32_t id, index; + uint32_t id; void *scrap; int rv; diff --git a/tests/idhash.c b/tests/idhash.c index 0609248b..600b17ae 100644 --- a/tests/idhash.c +++ b/tests/idhash.c @@ -8,7 +8,7 @@ // #include "convey.h" -#include "stubs.h" +#include "core/nng_impl.h" #include "core/idhash.c" Main({ diff --git a/tests/inproc.c b/tests/inproc.c index 89b43ced..cfbf3153 100644 --- a/tests/inproc.c +++ b/tests/inproc.c @@ -9,6 +9,7 @@ #include "convey.h" #include "trantest.h" +#include "core/nng_impl.h" // Inproc tests. diff --git a/tests/sock.c b/tests/sock.c index 6a122cdf..123354ac 100644 --- a/tests/sock.c +++ b/tests/sock.c @@ -8,7 +8,6 @@ // #include "convey.h" -#include "stubs.h" #include "nng.h" #include "core/nng_impl.h" @@ -47,7 +46,7 @@ Main({ int64_t when = 500000; uint64_t now; - now = getms(); + now = nni_clock(); rv = nng_setopt(sock, NNG_OPT_RCVTIMEO, &when, sizeof (when)); @@ -55,8 +54,8 @@ Main({ rv = nng_recvmsg(sock, &msg, 0); So(rv == NNG_ETIMEDOUT); So(msg == NULL); - So(getms() >= (now + (when/1000))); - So(getms() < (now + ((when/1000) * 2))); + So(nni_clock() >= (now + when)); + So(nni_clock() < (now + (when * 2))); }) Convey("Recv nonblock with no pipes gives EAGAIN", { @@ -74,15 +73,15 @@ Main({ // We cheat to get access to the core's clock. So(nng_msg_alloc(&msg, 0) == 0); So(msg != NULL); - now = getms(); + now = nni_clock(); rv = nng_setopt(sock, NNG_OPT_SNDTIMEO, &when, sizeof (when)); So(rv == 0); rv = nng_sendmsg(sock, msg, 0); So(rv == NNG_ETIMEDOUT); - So(getms() >= (now + (when/1000))); - So(getms() < (now + ((when/1000) * 2))); + So(nni_clock() >= (now + when)); + So(nni_clock() < (now + (when * 2))); nng_msg_free(msg); }) diff --git a/tests/stubs.h b/tests/stubs.h index 967074c4..c77b8db6 100644 --- a/tests/stubs.h +++ b/tests/stubs.h @@ -7,13 +7,10 @@ // found online at https://opensource.org/licenses/MIT. // -#include "convey.h" -#include "nng.h" -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> +#ifndef STUBS_H +#define STUBS_H +#include <stdint.h> #ifdef _WIN32 #include <windows.h> #else @@ -46,3 +43,5 @@ getms(void) return (((uint64_t)(tv.tv_sec ) * 1000) + (tv.tv_usec / 1000)); #endif } + +#endif // STUBS_H
\ No newline at end of file |
