diff options
-rw-r--r-- | example/src/middle.c | 4 | ||||
-rw-r--r-- | include/uv_link_t.h | 20 | ||||
-rw-r--r-- | src/uv_link_observer_t.c | 4 | ||||
-rw-r--r-- | src/uv_link_source_t.c | 4 | ||||
-rw-r--r-- | src/uv_link_t.c | 12 | ||||
-rw-r--r-- | test/src/test-uv-link-observer-t.c | 4 |
6 files changed, 25 insertions, 23 deletions
diff --git a/example/src/middle.c b/example/src/middle.c index 9e6d158..447a341 100644 --- a/example/src/middle.c +++ b/example/src/middle.c @@ -40,11 +40,11 @@ static void read_cb_override(uv_link_t* link, free(buf->base); - uv_link_invoke_alloc_cb(link, strlen(res), &tmp); + uv_link_propagate_alloc_cb(link, strlen(res), &tmp); assert(tmp.len >= strlen(res)); memcpy(tmp.base, res, strlen(res)); - uv_link_invoke_read_cb(link, strlen(res), &tmp); + uv_link_propagate_read_cb(link, strlen(res), &tmp); } diff --git a/include/uv_link_t.h b/include/uv_link_t.h index 919d5ec..a964211 100644 --- a/include/uv_link_t.h +++ b/include/uv_link_t.h @@ -62,13 +62,15 @@ UV_EXTERN void uv_link_close(uv_link_t* link); UV_EXTERN int uv_link_chain(uv_link_t* from, uv_link_t* to); UV_EXTERN int uv_link_unchain(uv_link_t* from, uv_link_t* to); -/* Use this to invoke methods */ -UV_EXTERN void uv_link_invoke_alloc_cb(uv_link_t* link, - size_t suggested_size, - uv_buf_t* buf); -UV_EXTERN void uv_link_invoke_read_cb(uv_link_t* link, - ssize_t nread, - const uv_buf_t* buf); +/* Use this to invoke parent link's methods */ +UV_EXTERN void uv_link_propagate_alloc_cb(uv_link_t* link, + size_t suggested_size, + uv_buf_t* buf); +UV_EXTERN void uv_link_propagate_read_cb(uv_link_t* link, + ssize_t nread, + const uv_buf_t* buf); + +/* Use this to invoke methods of `link` */ static int uv_link_read_start(uv_link_t* link) { return link->methods->read_start(link); @@ -97,7 +99,7 @@ static int uv_link_shutdown(uv_link_t* link, uv_link_shutdown_cb cb) { return link->methods->shutdown(link, cb); } -/* Source */ +/* Link Source */ struct uv_link_source_s { uv_link_t link; @@ -110,7 +112,7 @@ UV_EXTERN int uv_link_source_init(uv_link_source_t* source, uv_stream_t* stream); UV_EXTERN void uv_link_source_close(uv_link_source_t* source); -/* Observer */ +/* Link Observer */ struct uv_link_observer_s { uv_link_t link; diff --git a/src/uv_link_observer_t.c b/src/uv_link_observer_t.c index 3ce0df9..4ed26cc 100644 --- a/src/uv_link_observer_t.c +++ b/src/uv_link_observer_t.c @@ -58,7 +58,7 @@ static int uv_link_observer_shutdown(uv_link_t* link, uv_link_shutdown_cb cb) { static void uv_link_observer_alloc_cb(uv_link_t* link, size_t suggested_size, uv_buf_t* buf) { - return uv_link_invoke_alloc_cb(link, suggested_size, buf); + return uv_link_propagate_alloc_cb(link, suggested_size, buf); } @@ -72,7 +72,7 @@ static void uv_link_observer_read_cb(uv_link_t* link, if (observer->read_cb != NULL) observer->read_cb(observer, nread, buf); - return uv_link_invoke_read_cb(link, nread, buf); + return uv_link_propagate_read_cb(link, nread, buf); } diff --git a/src/uv_link_source_t.c b/src/uv_link_source_t.c index 11907cc..3601599 100644 --- a/src/uv_link_source_t.c +++ b/src/uv_link_source_t.c @@ -26,7 +26,7 @@ static void uv_link_source_wrap_alloc_cb(uv_handle_t* handle, source = handle->data; - uv_link_invoke_alloc_cb(&source->link, suggested_size, buf); + uv_link_propagate_alloc_cb(&source->link, suggested_size, buf); } @@ -37,7 +37,7 @@ static void uv_link_source_wrap_read_cb(uv_stream_t* stream, source = stream->data; - uv_link_invoke_read_cb(&source->link, nread, buf); + uv_link_propagate_read_cb(&source->link, nread, buf); } diff --git a/src/uv_link_t.c b/src/uv_link_t.c index fc6eabc..3e5436c 100644 --- a/src/uv_link_t.c +++ b/src/uv_link_t.c @@ -73,9 +73,9 @@ int uv_link_unchain(uv_link_t* from, uv_link_t* to) { } -void uv_link_invoke_alloc_cb(uv_link_t* link, - size_t suggested_size, - uv_buf_t* buf) { +void uv_link_propagate_alloc_cb(uv_link_t* link, + size_t suggested_size, + uv_buf_t* buf) { uv_link_t* target; target = link; @@ -86,9 +86,9 @@ void uv_link_invoke_alloc_cb(uv_link_t* link, } -void uv_link_invoke_read_cb(uv_link_t* link, - ssize_t nread, - const uv_buf_t* buf) { +void uv_link_propagate_read_cb(uv_link_t* link, + ssize_t nread, + const uv_buf_t* buf) { uv_link_t* target; target = link; diff --git a/test/src/test-uv-link-observer-t.c b/test/src/test-uv-link-observer-t.c index 3edf9ea..eaba1ab 100644 --- a/test/src/test-uv-link-observer-t.c +++ b/test/src/test-uv-link-observer-t.c @@ -33,10 +33,10 @@ TEST_IMPL(uv_link_observer_t) { observer.read_cb = observer_read_cb; - uv_link_invoke_alloc_cb(&source, 1024, &buf); + uv_link_propagate_alloc_cb(&source, 1024, &buf); buf.base[0] = 'x'; - uv_link_invoke_read_cb(&source, 1, &buf); + uv_link_propagate_read_cb(&source, 1, &buf); CHECK_EQ(observer_read_cb_called, 1, "observer.read_cb must be called"); CHECK_EQ(uv_link_observer_close(&observer), 0, "uv_link_observer_close"); |