From 575148ac9a274d61e45220fda7d8de6a420f4fe4 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Tue, 14 Jan 2025 08:29:37 -0800 Subject: api: pipes should use nng_err --- src/nng.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/nng.c') diff --git a/src/nng.c b/src/nng.c index d9b111a8..26f45f76 100644 --- a/src/nng.c +++ b/src/nng.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 @@ -1301,10 +1301,10 @@ nng_strerror(nng_err num) return (unknownerrbuf); } -static int +static nng_err pipe_get(nng_pipe p, const char *name, void *val, size_t *szp, nni_type t) { - int rv; + nng_err rv; nni_pipe *pipe; if ((rv = nni_pipe_find(&pipe, p.id)) != 0) { @@ -1315,37 +1315,37 @@ pipe_get(nng_pipe p, const char *name, void *val, size_t *szp, nni_type t) return (rv); } -int +nng_err nng_pipe_get_int(nng_pipe id, const char *n, int *v) { return (pipe_get(id, n, v, NULL, NNI_TYPE_INT32)); } -int +nng_err nng_pipe_get_bool(nng_pipe id, const char *n, bool *v) { return (pipe_get(id, n, v, NULL, NNI_TYPE_BOOL)); } -int +nng_err nng_pipe_get_size(nng_pipe id, const char *n, size_t *v) { return (pipe_get(id, n, v, NULL, NNI_TYPE_SIZE)); } -int +nng_err nng_pipe_get_string(nng_pipe id, const char *n, char **v) { return (pipe_get(id, n, v, NULL, NNI_TYPE_STRING)); } -int +nng_err nng_pipe_get_ms(nng_pipe id, const char *n, nng_duration *v) { return (pipe_get(id, n, v, NULL, NNI_TYPE_DURATION)); } -int +nng_err nng_pipe_get_addr(nng_pipe id, const char *n, nng_sockaddr *v) { return (pipe_get(id, n, v, NULL, NNI_TYPE_SOCKADDR)); @@ -1388,10 +1388,10 @@ nng_pipe_listener(nng_pipe p) return (l); } -int +nng_err nng_pipe_close(nng_pipe p) { - int rv; + nng_err rv; nni_pipe *pipe; if ((rv = nni_pipe_find(&pipe, p.id)) != 0) { @@ -1399,7 +1399,7 @@ nng_pipe_close(nng_pipe p) } nni_pipe_close(pipe); nni_pipe_rele(pipe); - return (0); + return (NNG_OK); } int -- cgit v1.2.3-70-g09d2