mirror of
https://github.com/sbrow/zomq.git
synced 2026-08-26 19:03:31 -04:00
style: Re-arranged procs.
This commit is contained in:
@@ -2,7 +2,6 @@ package zmq
|
|||||||
|
|
||||||
import "core:c"
|
import "core:c"
|
||||||
import "core:os"
|
import "core:os"
|
||||||
import "core:strings"
|
|
||||||
|
|
||||||
foreign import lib "system:zmq"
|
foreign import lib "system:zmq"
|
||||||
|
|
||||||
@@ -152,12 +151,8 @@ send_string :: proc(s: Socket, buf: string, flags: Flags = {}) -> (int, Error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
send_const :: proc {
|
send_const :: proc {
|
||||||
send_const_string,
|
|
||||||
send_const_bytes,
|
send_const_bytes,
|
||||||
}
|
send_const_string,
|
||||||
|
|
||||||
send_const_string :: proc(s: Socket, $str: string, flags: Flags = {}) -> (int, Error) {
|
|
||||||
return send_const_bytes(s, transmute([]byte)str, flags)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// buf must have @(rodata) or global lifetime.
|
// buf must have @(rodata) or global lifetime.
|
||||||
@@ -170,6 +165,10 @@ send_const_bytes :: proc(s: Socket, buf: []byte, flags: Flags = {}) -> (int, Err
|
|||||||
return int(n), nil
|
return int(n), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
send_const_string :: proc(s: Socket, $str: string, flags: Flags = {}) -> (int, Error) {
|
||||||
|
return send_const_bytes(s, transmute([]byte)str, flags)
|
||||||
|
}
|
||||||
|
|
||||||
recv :: proc(s: Socket, buf: []u8, flags: Flags = Flags{}) -> (int, Error) {
|
recv :: proc(s: Socket, buf: []u8, flags: Flags = Flags{}) -> (int, Error) {
|
||||||
n := _recv(s, rawptr(&buf[0]), c.size_t(len(buf)), flags)
|
n := _recv(s, rawptr(&buf[0]), c.size_t(len(buf)), flags)
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user