~sircmpwn/hare-users

hare-ev: *void -> *opaque v1 APPLIED

francorbacho: 1
 *void -> *opaque

 3 files changed, 12 insertions(+), 12 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/hare-users/patches/44175/mbox | git am -3
Learn more about email & git

[PATCH hare-ev] *void -> *opaque Export this patch

---
 cmd/tcpclient/main.ha |  2 +-
 ev/+linux/file.ha     | 12 ++++++------
 ev/+linux/socket.ha   | 10 +++++-----
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/cmd/tcpclient/main.ha b/cmd/tcpclient/main.ha
index 00af0fd..74635cb 100644
--- a/cmd/tcpclient/main.ha
+++ b/cmd/tcpclient/main.ha
@@ -42,7 +42,7 @@ export fn main() void = {
	for (ev::dispatch(&loop, -1)!) void;
};

fn connected(result: (*ev::file | net::error), user: nullable *void) void = {
fn connected(result: (*ev::file | net::error), user: nullable *opaque) void = {
	const state = user: *state;
	const sock = match (result) {
	case let err: net::error =>
diff --git a/ev/+linux/file.ha b/ev/+linux/file.ha
index 303404b..ee2c0fe 100644
--- a/ev/+linux/file.ha
+++ b/ev/+linux/file.ha
@@ -33,9 +33,9 @@ export type file = struct {

	flags: fflags,
	op: op,
	cb: nullable *void,
	cb2: nullable *void,
	user: nullable *void,
	cb: nullable *opaque,
	cb2: nullable *opaque,
	user: nullable *opaque,

	// Operation-specific data
	union {
@@ -118,14 +118,14 @@ export fn close(file: *file) void = {
};

// Sets the user data field on this file object to the provided object.
export fn setuser(file: *file, user: nullable *void) void = {
export fn setuser(file: *file, user: nullable *opaque) void = {
	file.user = user;
};

// Returns the user data field from this file object. If the field was null, an
// assertion is raised.
export fn getuser(file: *file) *void = {
	return file.user as *void;
export fn getuser(file: *file) *opaque = {
	return file.user as *opaque;
};

// Returns the file descriptor for a given file. Note that ev assumes that it
diff --git a/ev/+linux/socket.ha b/ev/+linux/socket.ha
index fb2533b..a3b9a16 100644
--- a/ev/+linux/socket.ha
+++ b/ev/+linux/socket.ha
@@ -42,7 +42,7 @@ export fn connect_udp(
	return file;
};

export type connectcb = fn(result: (*file | net::error), user: nullable *void) void;
export type connectcb = fn(result: (*file | net::error), user: nullable *opaque) void;

// Creates a socket and connects to a given IP address and port over TCP.
//
@@ -54,7 +54,7 @@ export type connectcb = fn(result: (*file | net::error), user: nullable *void) v
//	let user: state = // ...
// 	ev::connect_tcp(&loop, &connected, addr, port, &user);
//
// 	fn connected(result: (*ev::file | net::error), user: nullable *void) void = {
// 	fn connected(result: (*ev::file | net::error), user: nullable *opaque) void = {
// 		let user = user: *state;
// 	};
//
@@ -69,16 +69,16 @@ export fn connect_tcp(
	cb: *connectcb,
	addr: ip::addr,
	port: u16,
	opts: (net::sockflag | *void)...
	opts: (net::sockflag | *opaque)...
) (void | net::error | errors::error) = {
	// XXX: This doesn't let us set keepalive
	let opt: net::sockflag = 0;
	let user: nullable *void = null;
	let user: nullable *opaque = null;
	for (let i = 0z; i < len(opts); i += 1) {
		match (opts[i]) {
		case let o: net::sockflag =>
			opt |= o;
		case let u: *void =>
		case let u: *opaque =>
			assert(user == null);
			user = u;
		};
-- 
2.42.0
Thanks!

To git@git.sr.ht:~sircmpwn/hare-ev
   5082e73..b6e30b5  master -> master