removing some unneeded native fn mappingsin uv.rs and misc clean

.. 32bit linux issues persist.
This commit is contained in:
Jeff Olson 2012-04-04 09:28:26 -07:00 committed by Brian Anderson
parent 6b349f3d11
commit 82f8d8cb2a
4 changed files with 11 additions and 48 deletions

View file

@ -63,36 +63,6 @@ native mod rustrt {
repeat: libc::c_uint); repeat: libc::c_uint);
fn rust_uv_timer_stop(handle: *libc::c_void); fn rust_uv_timer_stop(handle: *libc::c_void);
fn rust_uv_free(ptr: *libc::c_void); fn rust_uv_free(ptr: *libc::c_void);
fn rust_uv_tcp_init(
loop_handle: *libc::c_void,
handle_ptr: *ll::uv_tcp_t) -> libc::c_int;
// FIXME ref #2064
fn rust_uv_strerror(err: *ll::uv_err_t) -> *libc::c_char;
// FIXME ref #2064
fn rust_uv_err_name(err: *ll::uv_err_t) -> *libc::c_char;
fn rust_uv_ip4_addr(ip: *u8, port: libc::c_int)
-> ll::sockaddr_in;
// FIXME ref #2064
fn rust_uv_tcp_connect(connect_ptr: *ll::uv_connect_t,
tcp_handle_ptr: *ll::uv_tcp_t,
++after_cb: *u8,
++addr: *ll::sockaddr_in) -> libc::c_int;
// FIXME ref 2064
fn rust_uv_tcp_bind(tcp_server: *ll::uv_tcp_t,
++addr: *ll::sockaddr_in) -> libc::c_int;
fn rust_uv_listen(stream: *libc::c_void, backlog: libc::c_int,
cb: *u8) -> libc::c_int;
fn rust_uv_accept(server: *libc::c_void, client: *libc::c_void)
-> libc::c_int;
fn rust_uv_write(req: *libc::c_void, stream: *libc::c_void,
++buf_in: *ll::uv_buf_t, buf_cnt: libc::c_int,
cb: *u8) -> libc::c_int;
fn rust_uv_read_start(stream: *libc::c_void, on_alloc: *u8,
on_read: *u8) -> libc::c_int;
fn rust_uv_read_stop(stream: *libc::c_void) -> libc::c_int;
fn rust_uv_malloc_buf_base_of(sug_size: libc::size_t) -> *u8;
fn rust_uv_free_base_of_buf(++buf: ll::uv_buf_t);
// sizeof testing helpers // sizeof testing helpers
fn rust_uv_helper_uv_tcp_t_size() -> libc::c_uint; fn rust_uv_helper_uv_tcp_t_size() -> libc::c_uint;
fn rust_uv_helper_uv_connect_t_size() -> libc::c_uint; fn rust_uv_helper_uv_connect_t_size() -> libc::c_uint;
@ -715,7 +685,7 @@ crust fn after_close_cb(handle: *libc::c_void) {
} }
crust fn on_alloc_cb(handle: *libc::c_void, crust fn on_alloc_cb(handle: *libc::c_void,
suggested_size: libc::size_t) ++suggested_size: libc::size_t)
-> ll::uv_buf_t unsafe { -> ll::uv_buf_t unsafe {
io::println("on_alloc_cb!"); io::println("on_alloc_cb!");
let char_ptr = ll::malloc_buf_base_of(suggested_size); let char_ptr = ll::malloc_buf_base_of(suggested_size);
@ -909,6 +879,10 @@ crust fn on_server_read_cb(client_stream_ptr: *ll::uv_stream_t,
// pull out the contents of the write from the client // pull out the contents of the write from the client
let buf_base = ll::get_base_from_buf(buf); let buf_base = ll::get_base_from_buf(buf);
let buf_len = ll::get_len_from_buf(buf); let buf_len = ll::get_len_from_buf(buf);
io::println(#fmt("SERVER buf base: %u, len: %u, nread: %d",
buf_base as uint,
buf_len as uint,
nread));
let bytes = vec::unsafe::from_buf(buf_base, buf_len); let bytes = vec::unsafe::from_buf(buf_base, buf_len);
let request_str = str::from_bytes(bytes); let request_str = str::from_bytes(bytes);
@ -1246,3 +1220,4 @@ fn test_uv_struct_size_uv_async_t() {
io::println(output); io::println(output);
assert native_handle_size as uint == rust_handle_size; assert native_handle_size as uint == rust_handle_size;
} }

View file

@ -71,7 +71,6 @@ immediately after using `uv::ll::loop_new()`
A `high_level_loop` record that can be used to interact with the A `high_level_loop` record that can be used to interact with the
loop (after you use `uv::ll::run()` on the `uv_loop_t*`, of course loop (after you use `uv::ll::run()` on the `uv_loop_t*`, of course
"] "]
#[cfg(target_archsdfsdf="bleh")]
unsafe fn prepare_loop(loop_ptr: *libc::c_void) unsafe fn prepare_loop(loop_ptr: *libc::c_void)
-> high_level_loop { -> high_level_loop {
// will probably need to stake out a data record // will probably need to stake out a data record

View file

@ -442,8 +442,6 @@ native mod rustrt {
// FIXME ref #2604 .. ? // FIXME ref #2604 .. ?
fn rust_uv_buf_init(out_buf: *uv_buf_t, base: *u8, fn rust_uv_buf_init(out_buf: *uv_buf_t, base: *u8,
len: libc::size_t); len: libc::size_t);
fn rust_uv_buf_init_2(++base: *u8, len: libc::size_t)
-> uv_buf_t;
fn rust_uv_last_error(loop_handle: *libc::c_void) -> uv_err_t; fn rust_uv_last_error(loop_handle: *libc::c_void) -> uv_err_t;
// FIXME ref #2064 // FIXME ref #2064
fn rust_uv_strerror(err: *uv_err_t) -> *libc::c_char; fn rust_uv_strerror(err: *uv_err_t) -> *libc::c_char;

View file

@ -302,22 +302,13 @@ current_kernel_malloc_alloc_cb(uv_handle_t* handle,
extern "C" void extern "C" void
rust_uv_buf_init(uv_buf_t* out_buf, char* base, size_t len) { rust_uv_buf_init(uv_buf_t* out_buf, char* base, size_t len) {
printf("rust_uv_buf_init: base: %lu len: %lu\n", printf("rust_uv_buf_init: base: %lu len: %lu\n",
(long unsigned int)base, (long unsigned int)base,
(long unsigned int)len); (long unsigned int)len);
*out_buf = uv_buf_init(base, len); *out_buf = uv_buf_init(base, len);
printf("rust_uv_buf_init: after: result->base: %lu len: %lu\n", printf("rust_uv_buf_init: after: result->base: %lu len: %lu\n",
(unsigned long int)(*out_buf).base, (unsigned long int)(*out_buf).base,
(unsigned long int)(*out_buf).len); (unsigned long int)(*out_buf).len);
}
extern "C" uv_buf_t
rust_uv_buf_init_2(char* base, size_t len) {
printf("uv_buf_init: base ptr %p\n len: %lu", base,
(long unsigned int)len);
uv_buf_t result = uv_buf_init(base, len);
printf("after uv_buf_init: result->base %p\n",
result.base);
return result;
} }
extern "C" uv_loop_t* extern "C" uv_loop_t*