summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJake Woltersdorf <jake@playruyi.com>2019-02-24 22:40:28 +0800
committerGarrett D'Amore <garrett@damore.org>2019-02-24 22:44:25 -0800
commit9cf967e9d7fdab6ccf38f80d83e4bf3d1a5e1a67 (patch)
tree4b0abc612da6d19b90ee0d8f47752d49f5f095ef
parent7a895e10d8a08b66d2d416422d3c6aa0c2838d6f (diff)
downloadnng-9cf967e9d7fdab6ccf38f80d83e4bf3d1a5e1a67.tar.gz
nng-9cf967e9d7fdab6ccf38f80d83e4bf3d1a5e1a67.tar.bz2
nng-9cf967e9d7fdab6ccf38f80d83e4bf3d1a5e1a67.zip
fixes #894 nng_pipe_notify could use nng_pipe_ev typedef instead of int
- Update nng_pipe_notify manpage including copyright
-rw-r--r--docs/man/nng_pipe_notify.3.adoc11
-rw-r--r--include/nng/nng.h4
-rw-r--r--src/nng.c2
3 files changed, 9 insertions, 8 deletions
diff --git a/docs/man/nng_pipe_notify.3.adoc b/docs/man/nng_pipe_notify.3.adoc
index 314faebd..d5d75400 100644
--- a/docs/man/nng_pipe_notify.3.adoc
+++ b/docs/man/nng_pipe_notify.3.adoc
@@ -1,7 +1,8 @@
= nng_pipe_notify(3)
//
-// Copyright 2018 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2019 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
+// Copyright 2019 Devolutions <info@devolutions.net>
//
// This document is supplied under the terms of the MIT License, a
// copy of which should be located in the distribution where this
@@ -19,15 +20,15 @@ nng_pipe_notify - register pipe notification callback
----
#include <nng/nng.h>
-enum {
+typedef enum {
NNG_PIPE_EV_ADD_PRE,
NNG_PIPE_EV_ADD_POST,
NNG_PIPE_EV_REM_POST,
-};
+} nng_pipe_ev;
-typedef void (*nng_pipe_cb)(nng_pipe, int, void *);
+typedef void (*nng_pipe_cb)(nng_pipe, nng_pipe_ev, void *);
-int nng_pipe_notify(nng_socket s, int ev, nng_pipe_cb cb, void *arg);
+int nng_pipe_notify(nng_socket s, nng_pipe_ev ev, nng_pipe_cb cb, void *arg);
----
== DESCRIPTION
diff --git a/include/nng/nng.h b/include/nng/nng.h
index 4c29e476..487fa4b4 100644
--- a/include/nng/nng.h
+++ b/include/nng/nng.h
@@ -232,12 +232,12 @@ typedef enum {
NNG_PIPE_EV_NUM, // Used internally, must be last.
} nng_pipe_ev;
-typedef void (*nng_pipe_cb)(nng_pipe, int, void *);
+typedef void (*nng_pipe_cb)(nng_pipe, nng_pipe_ev, void *);
// nng_pipe_notify registers a callback to be executed when the
// given event is triggered. To watch for different events, register
// multiple times. Each event can have at most one callback registered.
-NNG_DECL int nng_pipe_notify(nng_socket, int, nng_pipe_cb, void *);
+NNG_DECL int nng_pipe_notify(nng_socket, nng_pipe_ev, nng_pipe_cb, void *);
// nng_getopt_string is special -- it allocates a string to hold the
// resulting string, which should be freed with nng_strfree when it is
diff --git a/src/nng.c b/src/nng.c
index 3c818ee0..abbf9c62 100644
--- a/src/nng.c
+++ b/src/nng.c
@@ -1017,7 +1017,7 @@ nng_getopt_string(nng_socket s, const char *name, char **valp)
}
int
-nng_pipe_notify(nng_socket s, int ev, nng_pipe_cb cb, void *arg)
+nng_pipe_notify(nng_socket s, nng_pipe_ev ev, nng_pipe_cb cb, void *arg)
{
int rv;
nni_sock *sock;