header: introduce uv_loop_size()

We add a function called uv_loop_size which returns the size of
the loop. It is an additional function which complements
`uv_handle_size` and` uv_req_size` in order to provide full FFI
support.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
This commit is contained in:
Andrius Bentkus 2014-06-23 17:13:21 +03:00 committed by Fedor Indutny
parent 6de622c3e4
commit e392a1af4d
2 changed files with 10 additions and 0 deletions

View File

@ -288,6 +288,11 @@ UV_EXTERN uv_loop_t* uv_loop_new(void);
*/
UV_EXTERN void uv_loop_delete(uv_loop_t*);
/*
* Returns size of the loop struct, useful for dynamic lookup with FFI
*/
UV_EXTERN size_t uv_loop_size(void);
/*
* This function runs the event loop. It will act differently depending on the
* specified mode:

View File

@ -67,6 +67,11 @@ size_t uv_req_size(uv_req_type type) {
#undef XX
size_t uv_loop_size(void) {
return sizeof(uv_loop_t);
}
uv_buf_t uv_buf_init(char* base, unsigned int len) {
uv_buf_t buf;
buf.base = base;