~sircmpwn/hare-dev

1

[PATCH hare-irc] Fix builds

Details
Message ID
<20240504084000.5798-1-amk@amk.ie>
DKIM signature
pass
Download raw message
---
 cmd/testbot/main.ha |  4 ++--
 net/irc/client.ha   |  9 ++++-----
 net/irc/isupport.ha |  4 ++--
 net/irc/message.ha  |  4 +---
 net/irc/state.ha    | 24 ++++++++++++------------
 5 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/cmd/testbot/main.ha b/cmd/testbot/main.ha
index e09af6b..e073410 100644
--- a/cmd/testbot/main.ha
+++ b/cmd/testbot/main.ha
@@ -43,7 +43,7 @@ export fn main() void = {
 	for (!(irc::dispatch(conn)! is io::EOF)) void;
 };
 
-fn logmsg(state: nullable *void, party: irc::party, msg: *irc::message) void = {
+fn logmsg(state: nullable *opaque, party: irc::party, msg: *irc::message) void = {
 	switch (party) {
 	case irc::party::SERVER =>
 		fmt::print("<= ")!;
@@ -58,7 +58,7 @@ fn logmsg(state: nullable *void, party: irc::party, msg: *irc::message) void = {
 };
 
 fn handle_privmsg(
-	state: nullable *void,
+	state: nullable *opaque,
 	msg: const *irc::message,
 ) (void | irc::error) = {
 	fmt::printfln("PRIVMSG from {}: {}", msg.prefix.nick, msg.params[1])!;
diff --git a/net/irc/client.ha b/net/irc/client.ha
index e4cc767..2428941 100644
--- a/net/irc/client.ha
+++ b/net/irc/client.ha
@@ -15,10 +15,10 @@ export type config = struct {
 	pass: str,
 	realname: str,
 	logfn: nullable *logfn,
-	logstate: nullable *void,
+	logstate: nullable *opaque,
 };
 
-export type logfn = fn(state: nullable *void, party: party, msg: *message) void;
+export type logfn = fn(state: nullable *opaque, party: party, msg: *message) void;
 
 export type client = struct {
 	conn: net::socket,
@@ -27,7 +27,7 @@ export type client = struct {
 	dirty: size,
 	nick: str,
 	logfn: nullable *logfn,
-	logstate: nullable *void,
+	logstate: nullable *opaque,
 	next_id: uint,
 	handlers: [64][]handler,
 	isupport: isupport,
@@ -171,3 +171,3 @@ export fn recv(client: *client) (message | io::EOF | error) = {
 		client.dirty = end + 2;
 		return msg;
 	};

 };
 
 // Performs a blocking read on the IRC connection, processes one message, and
@@ -226,7 +225,7 @@ export type party = enum {
 export fn setlog(
 	client: *client,
 	func: nullable *logfn,
-	state: nullable *void,
+	state: nullable *opaque,
 ) void = {
 	client.logfn = func;
 	client.logstate = state;
diff --git a/net/irc/isupport.ha b/net/irc/isupport.ha
index 280d59d..c35251e 100644
--- a/net/irc/isupport.ha
+++ b/net/irc/isupport.ha
@@ -194,7 +194,7 @@ fn isupport_setparam(
 		};
 	case "CHANTYPES" =>
 		free(sup.chantypes);
-		sup.chantypes = strings::runes(value);
+		sup.chantypes = strings::torunes(value);
 	case "NETWORK" =>
 		free(sup.network);
 		sup.network = strings::dup(value);
@@ -238,7 +238,7 @@ fn isupport_setparam(
 };
 
 fn handle_isupport(
-	state: nullable *void,
+	state: nullable *opaque,
 	msg: const *message,
 ) (void | error) = {
 	let client = state: *client;
diff --git a/net/irc/message.ha b/net/irc/message.ha
index 6d9533a..82799cc 100644
--- a/net/irc/message.ha
+++ b/net/irc/message.ha
@@ -62,7 +62,7 @@ export fn parse(in: const str) (message | invalid) = {
 // will handle truncation if required.
 export fn serialize(sink: io::handle, msg: *message) (size | io::error) = {
 	let buf: [MAXLEN + 2]u8 = [0...];
-	let sink = bufio::buffered(sink, [], buf[..]);
+	let sink = bufio::init(sink, [], buf[..]);
 	defer io::close(&sink)!;
 
 	let z = 0z;
@@ -164,7 +164,6 @@ fn next(tok: *strings::tokenizer) (str | invalid) = {
 			return invalid;
 		};
 	};
-	abort(); // Unreachable
 };
 
 fn peek(tok: *strings::tokenizer) (str | void) = {
@@ -180,5 +179,4 @@ fn peek(tok: *strings::tokenizer) (str | void) = {
 			return;
 		};
 	};
-	abort(); // Unreachable
 };
diff --git a/net/irc/state.ha b/net/irc/state.ha
index 9d3f182..5a955fc 100644
--- a/net/irc/state.ha
+++ b/net/irc/state.ha
@@ -6,7 +6,7 @@ use time;
 
 // A function which handles an incoming IRC message.
 export type callback = fn(
-	state: nullable *void,
+	state: nullable *opaque,
 	msg: const *message,
 ) (void | error);
 
@@ -14,7 +14,7 @@ export type handler = struct {
 	id: uint,
 	cmd: const str,
 	func: *callback,
-	state: nullable *void,
+	state: nullable *opaque,
 };
 
 // Registers a callback for an IRC event, returning the internally assigned ID
@@ -26,7 +26,7 @@ export fn on(
 	client: *client,
 	cmd: const str,
 	callback: *callback,
-	state: nullable *void,
+	state: nullable *opaque,
 ) uint = {
 	const hash = fnv::string(cmd);
 	const bucket = &client.handlers[hash % len(client.handlers)];
@@ -97,12 +97,12 @@ fn delchan(client: *client, name: str) void = {
 	};
 };
 
-fn handle_ping(state: nullable *void, msg: const *message) (void | error) = {
+fn handle_ping(state: nullable *opaque, msg: const *message) (void | error) = {
 	let client = state: *client;
 	send(client, "PONG", msg.params...)?;
 };
 
-fn handle_topic(state: nullable *void, msg: const *message) (void | error) = {
+fn handle_topic(state: nullable *opaque, msg: const *message) (void | error) = {
 	let client = state: *client;
 	let chan = getchan(client, msg.params[1]);
 	free(chan.topic);
@@ -110,7 +110,7 @@ fn handle_topic(state: nullable *void, msg: const *message) (void | error) = {
 };
 
 fn handle_topicwhotime(
-	state: nullable *void,
+	state: nullable *opaque,
 	msg: const *message,
 ) (void | error) = {
 	let client = state: *client;
@@ -126,7 +126,7 @@ fn handle_topicwhotime(
 };
 
 fn handle_namereply(
-	state: nullable *void,
+	state: nullable *opaque,
 	msg: const *message,
 ) (void | error) = {
 	let client = state: *client;
@@ -150,7 +150,7 @@ fn handle_namereply(
 };
 
 fn handle_nick(
-	state: nullable *void,
+	state: nullable *opaque,
 	msg: const *message,
 ) (void | error) = {
 	let client = state: *client;
@@ -173,7 +173,7 @@ fn handle_nick(
 };
 
 fn handle_join(
-	state: nullable *void,
+	state: nullable *opaque,
 	msg: const *message,
 ) (void | error) = {
 	let client = state: *client;
@@ -201,7 +201,7 @@ fn handle_join(
 };
 
 fn handle_part(
-	state: nullable *void,
+	state: nullable *opaque,
 	msg: const *message,
 ) (void | error) = {
 	let client = state: *client;
@@ -222,7 +222,7 @@ fn handle_part(
 };
 
 fn handle_kick(
-	state: nullable *void,
+	state: nullable *opaque,
 	msg: const *message,
 ) (void | error) = {
 	let client = state: *client;
@@ -247,7 +247,7 @@ fn handle_kick(
 };
 
 fn handle_quit(
-	state: nullable *void,
+	state: nullable *opaque,
 	msg: const *message,
 ) (void | error) = {
 	let client = state: *client;
-- 
2.45.0
Details
Message ID
<D1KCJI8ETU9W.2RFNWIJBIH8PY@cmpwn.com>
In-Reply-To
<20240504084000.5798-1-amk@amk.ie> (view parent)
DKIM signature
pass
Download raw message
Does not apply
Reply to thread Export thread (mbox)