From a7a2cdb0201a6e85caae621e748cfab03998b6a6 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Tue, 14 Jan 2025 23:15:48 -0800 Subject: init: use nng_err --- docs/ref/api/init.md | 2 +- include/nng/nng.h | 2 +- src/core/init.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/ref/api/init.md b/docs/ref/api/init.md index 6e737cf3..09708d28 100644 --- a/docs/ref/api/init.md +++ b/docs/ref/api/init.md @@ -17,7 +17,7 @@ typedef struct { int16_t num_resolver_threads; } nng_init_params; -extern int nng_init(nng_init_parms *params); +extern nng_err nng_init(nng_init_parms *params); ``` Before using other interfaces in this library, it is necessary to initialize diff --git a/include/nng/nng.h b/include/nng/nng.h index 7ad814c4..bec1dd82 100644 --- a/include/nng/nng.h +++ b/include/nng/nng.h @@ -1292,7 +1292,7 @@ typedef struct { // only the first call can contain a non-NULL params. If already // initialized with non-NULL params, will return NNG_EALREADY. // Applications should *not* call a matching nng_fini() in that case. -NNG_DECL int nng_init(nng_init_params *parms); +NNG_DECL nng_err nng_init(nng_init_params *parms); // nng_fini is used to terminate the library, freeing certain global resources. // Each call to nng_fini is paired to a call to nng_init. The last such diff --git a/src/core/init.c b/src/core/init.c index 9d9cdf48..974f4f2e 100644 --- a/src/core/init.c +++ b/src/core/init.c @@ -1,5 +1,5 @@ // -// Copyright 2024 Staysail Systems, Inc. +// Copyright 2025 Staysail Systems, Inc. // Copyright 2018 Capitar IT Group BV // // This software is supplied under the terms of the MIT License, a @@ -49,11 +49,11 @@ static nng_init_params init_params; unsigned int init_count; nni_atomic_flag init_busy; -int +nng_err nng_init(nng_init_params *params) { nng_init_params zero = { 0 }; - int rv; + nng_err rv; // cheap spin lock while (nni_atomic_flag_test_and_set(&init_busy)) { -- cgit v1.2.3-70-g09d2