aboutsummaryrefslogtreecommitdiff
path: root/tests/tcp.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-04-26 15:36:13 -0700
committerGarrett D'Amore <garrett@damore.org>2018-04-26 19:13:59 -0700
commitfd06aba05381055ab56e1ec81d56055b66462f0b (patch)
tree99633af36e1c393bffeda213c0ac85e83fc4a6ee /tests/tcp.c
parent3de2b56557c80b310341c423492bd8ba895c1abe (diff)
downloadnng-fd06aba05381055ab56e1ec81d56055b66462f0b.tar.gz
nng-fd06aba05381055ab56e1ec81d56055b66462f0b.tar.bz2
nng-fd06aba05381055ab56e1ec81d56055b66462f0b.zip
fixes #375 integer types are error prone
This change converts the various integer types like nng_socket in the public API to opaque structures that are passed by value. Basically we just wrap the integer ID. This "hack" give us strong type checks by the compiler (yay!), at the expense of not being able to directly use these as numbers (so comparisions for example don't work, and neither does initialization to zero using the normal method. Comparison of disassembly output shows that at least with the optimizer enabled there is no difference in the compiler output between using a structure or an integral value.
Diffstat (limited to 'tests/tcp.c')
-rw-r--r--tests/tcp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/tcp.c b/tests/tcp.c
index 2677222d..3d2ecfc8 100644
--- a/tests/tcp.c
+++ b/tests/tcp.c
@@ -30,7 +30,7 @@ check_props_v4(nng_msg *msg)
bool b;
p = nng_msg_get_pipe(msg);
- So(p > 0);
+ So(p.id > 0);
So(nng_pipe_getopt_sockaddr(p, NNG_OPT_LOCADDR, &la) == 0);
So(la.s_family == NNG_AF_INET);
So(la.s_in.sa_port == htons(trantest_port - 1));