Skip to content

Commit 7eb2a5b

Browse files
committed
rt: Remove useless libuv wrappers. #5429
This removes almost all of the simple wrappers from rust_uv.cpp. For some reason uv_getaddrinfo and uv_freeaddrinfo still can't be removed.
1 parent b21f37c commit 7eb2a5b

File tree

4 files changed

+85
-229
lines changed

4 files changed

+85
-229
lines changed

src/libcore/rt/uvll.rs

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ pub enum uv_req_type {
9898

9999
pub unsafe fn malloc_handle(handle: uv_handle_type) -> *c_void {
100100
assert!(handle != UV_UNKNOWN_HANDLE && handle != UV_HANDLE_TYPE_MAX);
101-
let size = rust_uv_handle_size(handle as uint);
101+
let size = uv_handle_size(handle as uint);
102102
let p = malloc(size);
103103
assert!(p.is_not_null());
104104
return p;
@@ -110,7 +110,7 @@ pub unsafe fn free_handle(v: *c_void) {
110110

111111
pub unsafe fn malloc_req(req: uv_req_type) -> *c_void {
112112
assert!(req != UV_UNKNOWN_REQ && req != UV_REQ_TYPE_MAX);
113-
let size = rust_uv_req_size(req as uint);
113+
let size = uv_req_size(req as uint);
114114
let p = malloc(size);
115115
assert!(p.is_not_null());
116116
return p;
@@ -135,7 +135,7 @@ fn request_sanity_check() {
135135
}
136136

137137
pub unsafe fn loop_new() -> *c_void {
138-
return rust_uv_loop_new();
138+
return uv_loop_new();
139139
}
140140

141141
pub unsafe fn loop_delete(loop_handle: *c_void) {
@@ -147,11 +147,11 @@ pub unsafe fn run(loop_handle: *c_void) {
147147
}
148148

149149
pub unsafe fn close<T>(handle: *T, cb: *u8) {
150-
rust_uv_close(handle as *c_void, cb);
150+
uv_close(handle as *c_void, cb);
151151
}
152152

153153
pub unsafe fn walk(loop_handle: *c_void, cb: *u8, arg: *c_void) {
154-
rust_uv_walk(loop_handle, cb, arg);
154+
uv_walk(loop_handle, cb, arg);
155155
}
156156

157157
pub unsafe fn idle_new() -> *uv_idle_t {
@@ -163,19 +163,19 @@ pub unsafe fn idle_delete(handle: *uv_idle_t) {
163163
}
164164

165165
pub unsafe fn idle_init(loop_handle: *uv_loop_t, handle: *uv_idle_t) -> c_int {
166-
rust_uv_idle_init(loop_handle, handle)
166+
uv_idle_init(loop_handle, handle)
167167
}
168168

169169
pub unsafe fn idle_start(handle: *uv_idle_t, cb: uv_idle_cb) -> c_int {
170-
rust_uv_idle_start(handle, cb)
170+
uv_idle_start(handle, cb)
171171
}
172172

173173
pub unsafe fn idle_stop(handle: *uv_idle_t) -> c_int {
174-
rust_uv_idle_stop(handle)
174+
uv_idle_stop(handle)
175175
}
176176

177177
pub unsafe fn tcp_init(loop_handle: *c_void, handle: *uv_tcp_t) -> c_int {
178-
return rust_uv_tcp_init(loop_handle, handle);
178+
return uv_tcp_init(loop_handle, handle);
179179
}
180180

181181
// FIXME ref #2064
@@ -212,24 +212,24 @@ pub unsafe fn tcp_getpeername6(tcp_handle_ptr: *uv_tcp_t, name: *sockaddr_in6) -
212212
}
213213

214214
pub unsafe fn listen<T>(stream: *T, backlog: c_int, cb: *u8) -> c_int {
215-
return rust_uv_listen(stream as *c_void, backlog, cb);
215+
return uv_listen(stream as *c_void, backlog, cb);
216216
}
217217

218218
pub unsafe fn accept(server: *c_void, client: *c_void) -> c_int {
219-
return rust_uv_accept(server as *c_void, client as *c_void);
219+
return uv_accept(server as *c_void, client as *c_void);
220220
}
221221

222222
pub unsafe fn write<T>(req: *uv_write_t, stream: *T, buf_in: &[uv_buf_t], cb: *u8) -> c_int {
223223
let buf_ptr = vec::raw::to_ptr(buf_in);
224224
let buf_cnt = vec::len(buf_in) as i32;
225-
return rust_uv_write(req as *c_void, stream as *c_void, buf_ptr, buf_cnt, cb);
225+
return uv_write(req as *c_void, stream as *c_void, buf_ptr, buf_cnt, cb);
226226
}
227227
pub unsafe fn read_start(stream: *uv_stream_t, on_alloc: *u8, on_read: *u8) -> c_int {
228-
return rust_uv_read_start(stream as *c_void, on_alloc, on_read);
228+
return uv_read_start(stream as *c_void, on_alloc, on_read);
229229
}
230230

231231
pub unsafe fn read_stop(stream: *uv_stream_t) -> c_int {
232-
return rust_uv_read_stop(stream as *c_void);
232+
return uv_read_stop(stream as *c_void);
233233
}
234234

235235
pub unsafe fn last_error(loop_handle: *c_void) -> uv_err_t {
@@ -244,11 +244,11 @@ pub unsafe fn err_name(err: *uv_err_t) -> *c_char {
244244
}
245245

246246
pub unsafe fn async_init(loop_handle: *c_void, async_handle: *uv_async_t, cb: *u8) -> c_int {
247-
return rust_uv_async_init(loop_handle, async_handle, cb);
247+
return uv_async_init(loop_handle, async_handle, cb);
248248
}
249249

250250
pub unsafe fn async_send(async_handle: *uv_async_t) {
251-
return rust_uv_async_send(async_handle);
251+
return uv_async_send(async_handle);
252252
}
253253
pub unsafe fn buf_init(input: *u8, len: uint) -> uv_buf_t {
254254
let out_buf = uv_buf_t { base: ptr::null(), len: 0 as size_t };
@@ -258,14 +258,14 @@ pub unsafe fn buf_init(input: *u8, len: uint) -> uv_buf_t {
258258
}
259259

260260
pub unsafe fn timer_init(loop_ptr: *c_void, timer_ptr: *uv_timer_t) -> c_int {
261-
return rust_uv_timer_init(loop_ptr, timer_ptr);
261+
return uv_timer_init(loop_ptr, timer_ptr);
262262
}
263263
pub unsafe fn timer_start(timer_ptr: *uv_timer_t, cb: *u8, timeout: uint,
264264
repeat: uint) -> c_int {
265-
return rust_uv_timer_start(timer_ptr, cb, timeout as c_uint, repeat as c_uint);
265+
return uv_timer_start(timer_ptr, cb, timeout as c_uint, repeat as c_uint);
266266
}
267267
pub unsafe fn timer_stop(timer_ptr: *uv_timer_t) -> c_int {
268-
return rust_uv_timer_stop(timer_ptr);
268+
return uv_timer_stop(timer_ptr);
269269
}
270270

271271
pub unsafe fn malloc_ip4_addr(ip: &str, port: int) -> *sockaddr_in {
@@ -352,29 +352,29 @@ pub struct uv_err_data {
352352

353353
extern {
354354

355-
fn rust_uv_handle_size(type_: uintptr_t) -> size_t;
356-
fn rust_uv_req_size(type_: uintptr_t) -> size_t;
355+
fn uv_handle_size(type_: uintptr_t) -> size_t;
356+
fn uv_req_size(type_: uintptr_t) -> size_t;
357357
fn rust_uv_handle_type_max() -> uintptr_t;
358358
fn rust_uv_req_type_max() -> uintptr_t;
359359

360360
// libuv public API
361-
fn rust_uv_loop_new() -> *c_void;
361+
fn uv_loop_new() -> *c_void;
362362
fn rust_uv_loop_delete(lp: *c_void);
363363
fn rust_uv_run(loop_handle: *c_void);
364-
fn rust_uv_close(handle: *c_void, cb: *u8);
365-
fn rust_uv_walk(loop_handle: *c_void, cb: *u8, arg: *c_void);
364+
fn uv_close(handle: *c_void, cb: *u8);
365+
fn uv_walk(loop_handle: *c_void, cb: *u8, arg: *c_void);
366366

367367
fn rust_uv_idle_new() -> *uv_idle_t;
368368
fn rust_uv_idle_delete(handle: *uv_idle_t);
369-
fn rust_uv_idle_init(loop_handle: *uv_loop_t, handle: *uv_idle_t) -> c_int;
370-
fn rust_uv_idle_start(handle: *uv_idle_t, cb: uv_idle_cb) -> c_int;
371-
fn rust_uv_idle_stop(handle: *uv_idle_t) -> c_int;
369+
fn uv_idle_init(loop_handle: *uv_loop_t, handle: *uv_idle_t) -> c_int;
370+
fn uv_idle_start(handle: *uv_idle_t, cb: uv_idle_cb) -> c_int;
371+
fn uv_idle_stop(handle: *uv_idle_t) -> c_int;
372372

373-
fn rust_uv_async_send(handle: *uv_async_t);
374-
fn rust_uv_async_init(loop_handle: *c_void,
373+
fn uv_async_send(handle: *uv_async_t);
374+
fn uv_async_init(loop_handle: *c_void,
375375
async_handle: *uv_async_t,
376376
cb: *u8) -> c_int;
377-
fn rust_uv_tcp_init(loop_handle: *c_void, handle_ptr: *uv_tcp_t) -> c_int;
377+
fn uv_tcp_init(loop_handle: *c_void, handle_ptr: *uv_tcp_t) -> c_int;
378378
// FIXME ref #2604 .. ?
379379
fn rust_uv_buf_init(out_buf: *uv_buf_t, base: *u8, len: size_t);
380380
fn rust_uv_last_error(loop_handle: *c_void) -> uv_err_t;
@@ -386,8 +386,6 @@ extern {
386386
fn rust_uv_ip6_addrp(ip: *u8, port: c_int) -> *sockaddr_in6;
387387
fn rust_uv_free_ip4_addr(addr: *sockaddr_in);
388388
fn rust_uv_free_ip6_addr(addr: *sockaddr_in6);
389-
fn rust_uv_ip4_name(src: *sockaddr_in, dst: *u8, size: size_t) -> c_int;
390-
fn rust_uv_ip6_name(src: *sockaddr_in6, dst: *u8, size: size_t) -> c_int;
391389
fn rust_uv_ip4_port(src: *sockaddr_in) -> c_uint;
392390
fn rust_uv_ip6_port(src: *sockaddr_in6) -> c_uint;
393391
// FIXME ref #2064
@@ -406,24 +404,24 @@ extern {
406404
fn rust_uv_tcp_bind6(tcp_server: *uv_tcp_t, ++addr: *sockaddr_in6) -> c_int;
407405
fn rust_uv_tcp_getpeername(tcp_handle_ptr: *uv_tcp_t, ++name: *sockaddr_in) -> c_int;
408406
fn rust_uv_tcp_getpeername6(tcp_handle_ptr: *uv_tcp_t, ++name: *sockaddr_in6) ->c_int;
409-
fn rust_uv_listen(stream: *c_void, backlog: c_int, cb: *u8) -> c_int;
410-
fn rust_uv_accept(server: *c_void, client: *c_void) -> c_int;
411-
fn rust_uv_write(req: *c_void,
407+
fn uv_listen(stream: *c_void, backlog: c_int, cb: *u8) -> c_int;
408+
fn uv_accept(server: *c_void, client: *c_void) -> c_int;
409+
fn uv_write(req: *c_void,
412410
stream: *c_void,
413411
++buf_in: *uv_buf_t,
414412
buf_cnt: c_int,
415413
cb: *u8) -> c_int;
416-
fn rust_uv_read_start(stream: *c_void,
414+
fn uv_read_start(stream: *c_void,
417415
on_alloc: *u8,
418416
on_read: *u8) -> c_int;
419-
fn rust_uv_read_stop(stream: *c_void) -> c_int;
420-
fn rust_uv_timer_init(loop_handle: *c_void,
417+
fn uv_read_stop(stream: *c_void) -> c_int;
418+
fn uv_timer_init(loop_handle: *c_void,
421419
timer_handle: *uv_timer_t) -> c_int;
422-
fn rust_uv_timer_start(timer_handle: *uv_timer_t,
420+
fn uv_timer_start(timer_handle: *uv_timer_t,
423421
cb: *u8,
424422
timeout: c_uint,
425423
repeat: c_uint) -> c_int;
426-
fn rust_uv_timer_stop(handle: *uv_timer_t) -> c_int;
424+
fn uv_timer_stop(handle: *uv_timer_t) -> c_int;
427425

428426
fn rust_uv_malloc_buf_base_of(sug_size: size_t) -> *u8;
429427
fn rust_uv_free_base_of_buf(++buf: uv_buf_t);

0 commit comments

Comments
 (0)