From 3583d5e407476b8836228c0abc52c400d74aba61 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 14 Dec 2016 18:53:10 -0800 Subject: 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. --- src/nng.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/nng.c') 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 -- cgit v1.2.3-70-g09d2