Skip to content

Commit 8bcbbd6

Browse files
olsonjefferybrson
authored andcommitted
---
yaml --- r: 15358 b: refs/heads/try c: af08aba h: refs/heads/master v: v3
1 parent 6493482 commit 8bcbbd6

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 3817ba7578a5044a5572f35de367b6ca31a35bc0
5+
refs/heads/try: af08aba5736aacae6662a2ac586bb559f0704cdc
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/libstd/uv.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ native mod rustrt {
273273
loop_handle: *ctypes::void,
274274
handle_ptr: *uv_tcp_t) -> ctypes::c_int;
275275
fn rust_uv_buf_init(base: *u8, len: ctypes::size_t)
276-
-> uv_buf_t;
276+
-> *ctypes::void;
277277
fn rust_uv_last_error(loop_handle: *ctypes::void) -> uv_err_t;
278278
fn rust_uv_ip4_addr(ip: *u8, port: ctypes::c_int)
279279
-> *ctypes::void;
@@ -352,10 +352,6 @@ mod direct {
352352
unsafe fn write_t() -> uv_write_t {
353353
ret gen_stub_uv_write_t();
354354
}
355-
// FIXME: see github issue #1402
356-
unsafe fn buf_init(input: *u8, len: uint) -> *ctypes::void {
357-
ret rustrt::rust_uv_buf_init(input, len);
358-
}
359355
unsafe fn get_loop_for_uv_handle(handle: *ctypes::void)
360356
-> *ctypes::void {
361357
ret rustrt::rust_uv_get_loop_for_uv_handle(handle);
@@ -373,6 +369,10 @@ mod direct {
373369
rustrt::rust_uv_set_data_for_req(req, data);
374370
}
375371
// FIXME: see github issue #1402
372+
unsafe fn buf_init(input: *u8, len: uint) -> *ctypes::void {
373+
ret rustrt::rust_uv_buf_init(input, len);
374+
}
375+
// FIXME: see github issue #1402
376376
unsafe fn ip4_addr(ip: str, port: ctypes::c_int)
377377
-> *ctypes::void {
378378
let addr_vec = str::bytes(ip);
@@ -382,10 +382,9 @@ mod direct {
382382
io::println(#fmt("vec val: '%s' length: %u",ip_back, vec::len(addr_vec)));
383383
ret rustrt::rust_uv_ip4_addr(addr_vec_ptr, port);
384384
}
385-
386385
// this is lame.
387386
// FIXME: see github issue #1402
388-
unsafe fn ip4_addr_free(ptr: *ctypes::void) {
387+
unsafe fn free_1402(ptr: *ctypes::void) {
389388
rustrt::rust_uv_free(ptr);
390389
}
391390
}
@@ -1033,7 +1032,7 @@ fn impl_uv_tcp_request() unsafe {
10331032
direct::run(test_loop);
10341033
io::println("after run tcp req loop");
10351034
// FIXME: see github issue #1402
1036-
direct::ip4_addr_free(addr);
1035+
direct::free_1402(addr);
10371036
}
10381037
else {
10391038
io::println("direct::tcp_connect() failure");

branches/try/src/rt/rust_uv.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,22 @@ rust_uv_get_stream_handle_for_connect(uv_connect_t* connect) {
234234
return connect->handle;
235235
}
236236

237-
extern "C" uv_buf_t
237+
static uv_buf_t
238+
current_kernel_malloc_alloc_cb(uv_handle_t* handle,
239+
size_t suggested_size) {
240+
char* base_ptr = (char*)current_kernel_malloc(sizeof(char)
241+
* suggested_size,
242+
"uv_buf_t_base_val");
243+
return uv_buf_init(base_ptr, suggested_size);
244+
}
245+
246+
// FIXME see issue #1402
247+
extern "C" void*
238248
rust_uv_buf_init(char* base, size_t len) {
239-
return uv_buf_init(base, len);
249+
uv_buf_t* buf_ptr = current_kernel_malloc(sizeof(uv_buf_t),
250+
"uv_buf_t_1402");
251+
*buf_ptr = uv_buf_init(base, len);
252+
return buf_ptr;
240253
}
241254

242255
extern "C" uv_loop_t*

0 commit comments

Comments
 (0)