aboutsummaryrefslogtreecommitdiff
path: root/src/nng.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2016-12-14 18:53:10 -0800
committerGarrett D'Amore <garrett@damore.org>2016-12-14 18:53:10 -0800
commit3583d5e407476b8836228c0abc52c400d74aba61 (patch)
tree113b6510b9f3d4f7eaffd331ecbd173724327c96 /src/nng.c
parente6476c5e4eac773aed4b76f16d3e76e7956c2468 (diff)
downloadnng-3583d5e407476b8836228c0abc52c400d74aba61.tar.gz
nng-3583d5e407476b8836228c0abc52c400d74aba61.tar.bz2
nng-3583d5e407476b8836228c0abc52c400d74aba61.zip
More robust platform definition support.
The idea is that someday it will be possible to just concatenate the entire set of source files into a single giant source file, for systems that want to work this way. As a result, the build system now compiles every file, although some of them will not have any definitions.
Diffstat (limited to 'src/nng.c')
-rw-r--r--src/nng.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/nng.c b/src/nng.c
index 123c69bd..9b10c3b1 100644
--- a/src/nng.c
+++ b/src/nng.c
@@ -36,21 +36,27 @@
int
nng_socket_create(nng_socket_t *s, uint16_t proto)
{
- nni_platform_init();
+ int rv;
+ if ((rv = nni_init()) != 0) {
+ return (rv);
+ }
return (nni_socket_create(s, proto));
}
int
nng_socket_close(nng_socket_t s)
{
- nni_platform_init();
+ int rv;
+ if ((rv = nni_init()) != 0) {
+ return (rv);
+ }
return (nni_socket_close(s));
}
uint16_t
nng_socket_protocol(nng_socket_t s)
{
- nni_platform_init();
+ nni_init();
return (nni_socket_protocol(s));
}
@@ -61,6 +67,7 @@ nng_socket_protocol(nng_socket_t s)
const char *
nng_strerror(int num)
{
+ nni_init();
switch (num) {
case 0:
return ("Hunky dory"); /* what did you expect? */
@@ -96,13 +103,16 @@ nng_strerror(int num)
int
nng_msg_alloc(nng_msg_t *msgp, size_t size)
{
- nni_platform_init();
+ int rv;
+ if ((rv = nni_init()) != 0) {
+ return (rv);
+ }
return (nni_msg_alloc(msgp, size));
}
void
nng_msg_free(nng_msg_t msg)
{
- nni_platform_init();
+ nni_init();
return (nni_msg_free(msg));
} \ No newline at end of file