diff options
author | Fedor Indutny <fedor@indutny.com> | 2016-06-04 14:46:01 -0400 |
---|---|---|
committer | Fedor Indutny <fedor@indutny.com> | 2016-06-04 14:46:01 -0400 |
commit | a66bb042e02bd1021a574c32a27fff087ab1c9f4 (patch) | |
tree | c4d99117635a7214d1a292f52d42d7688824cc0c | |
parent | 09d9895a8177876b5c84b80c43b94f3e205be05e (diff) | |
download | uv_link_t-a66bb042e02bd1021a574c32a27fff087ab1c9f4.tar.gz |
Revert "api: `uv_link_strerror`"
This reverts commit 0799c7c91ee710eb9ce752bcfcd6952a0838b495.
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | docs/api.md | 24 | ||||
-rw-r--r-- | include/uv_link_t.h | 7 | ||||
-rw-r--r-- | src/defaults.c | 8 | ||||
-rw-r--r-- | test/src/test-list.h | 1 | ||||
-rw-r--r-- | test/src/test-strerror.c | 35 | ||||
-rw-r--r-- | test/test.gyp | 1 |
7 files changed, 5 insertions, 76 deletions
diff --git a/README.md b/README.md index a8287c6..31952b9 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,11 @@ static int shutdown_impl(uv_link_t* link, [API Docs][2] [Implementation Guide][3] +## Further Work + +* Error reporting. Right now all we get is a UV_... error, it would be nice to + have a method for obtaining string description. + ## LICENSE This software is licensed under the MIT License. diff --git a/docs/api.md b/docs/api.md index b73a428..2d2877b 100644 --- a/docs/api.md +++ b/docs/api.md @@ -118,16 +118,6 @@ Invoke `shutdown` from the link's [`uv_link_methods_t`][]. Acts similarly to `uv_shutdown()`. `cb(uv_link_t* link, int status, void* arg)` is invoked on completion. -### const char* uv_link_strerror(...) - -* `uv_link_t* link` -* `int err` - error code, previously either returned the one of the - `uv_link...` methods or passed as a negative `nread` to `link->read_cb` - -Invoke `strerror` from the link's [`uv_link_methods_t`][]. Acts similarly to -`uv_strerror()`. Returns a description of error code that has just been given -back to the user. - ### void uv_link_propagate_alloc_cb(...) Should be used only by [`uv_link_methods_t`][] implementation. @@ -395,19 +385,6 @@ is passed only only for internal operation. *NOTE: semantics are the same as of `uv_close`.* -### .strerror - -```c -const char* (*strerror)(uv_link_t* link, int err); -``` - -Invoked by [`uv_link_strerror()`][]. - -Should return a description string of the `err`, or propagate call to the -`link->parent` if the error wasn't emitted by the current `link`. - -*NOTE: semantics are the same as of `uv_strerror`.* - ### .alloc_cb_override A method used to override that value of [`uv_link_t.alloc_cb`][] by @@ -491,7 +468,6 @@ Invoked by `uv_link_propagate_read_cb`. MUST not manage the data in `buf`. [`uv_link_chain()`]: #int-uv_link_chain [`uv_link_close()`]: #void-uv_link_close -[`uv_link_strerror()`]: #const-char-uv_link_strerror [`uv_link_init()`]: #int-uv_link_init [`uv_link_methods_t`]: #uv_link_methods_t [`uv_link_observer_t.observer_read_cb`]: #observer_read_cb diff --git a/include/uv_link_t.h b/include/uv_link_t.h index 9ba96ad..61d4cf0 100644 --- a/include/uv_link_t.h +++ b/include/uv_link_t.h @@ -40,8 +40,6 @@ struct uv_link_methods_s { void (*close)(uv_link_t* link, uv_link_t* source, uv_link_close_cb cb); - const char* (*strerror)(uv_link_t* link, int err); - /* Overriding callbacks */ uv_link_alloc_cb alloc_cb_override; uv_link_read_cb read_cb_override; @@ -122,10 +120,6 @@ static int uv_link_shutdown(uv_link_t* link, uv_link_shutdown_cb cb, return uv_link_propagate_shutdown(link, link, cb, arg); } -static const char* uv_link_strerror(uv_link_t* link, int err) { - return link->methods->strerror(link, err); -} - /* Link Source */ struct uv_link_source_s { @@ -176,7 +170,6 @@ int uv_link_default_shutdown(uv_link_t* link, void* arg); void uv_link_default_close(uv_link_t* link, uv_link_t* source, uv_link_close_cb cb); -const char* uv_link_default_strerror(uv_link_t* link, int err); void uv_link_default_alloc_cb_override(uv_link_t* link, size_t suggested_size, diff --git a/src/defaults.c b/src/defaults.c index a88c80d..1c486f8 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -43,14 +43,6 @@ void uv_link_default_close(uv_link_t* link, uv_link_t* source, } -const char* uv_link_default_strerror(uv_link_t* link, int err) { - if (link->parent == NULL) - return uv_strerror(err); - else - return uv_link_strerror(link->parent, err); -} - - void uv_link_default_alloc_cb_override(uv_link_t* link, size_t suggested_size, uv_buf_t* buf) { diff --git a/test/src/test-list.h b/test/src/test-list.h index abb7cda..591b858 100644 --- a/test/src/test-list.h +++ b/test/src/test-list.h @@ -6,7 +6,6 @@ V(uv_link_observer_t) \ V(close_depth) \ V(stop_read_on_error) \ - V(strerror) \ #define TEST_DECL(N) void test__##N(); diff --git a/test/src/test-strerror.c b/test/src/test-strerror.c deleted file mode 100644 index c3b44c2..0000000 --- a/test/src/test-strerror.c +++ /dev/null @@ -1,35 +0,0 @@ -#include <sys/socket.h> -#include <unistd.h> - -#include "test-common.h" - -static uv_link_t st_link; - -static int close_cb_called; - - -const char* test_strerror(uv_link_t* l, int err) { - CHECK_EQ(l, &st_link, "link == st_link"); - return "Description"; -} - - -static uv_link_methods_t methods = { - .strerror = test_strerror, - .close = uv_link_default_close -}; - -static void close_cb(uv_link_t* l) { - close_cb_called++; -} - - -TEST_IMPL(strerror) { - CHECK_EQ(uv_link_init(&st_link, &methods), 0, "uv_link_init()"); - - CHECK_EQ(strcmp(uv_link_strerror(&st_link, -1), "Description"), 0, - "error description should match"); - - uv_link_close(&st_link, close_cb); - CHECK_EQ(close_cb_called, 1, "close_cb must be called"); -} diff --git a/test/test.gyp b/test/test.gyp index 131b93a..0bd930d 100644 --- a/test/test.gyp +++ b/test/test.gyp @@ -18,7 +18,6 @@ "src/test-uv-link-observer-t.c", "src/test-defaults.c", "src/test-close.c", - "src/test-strerror.c", ], }], } |