aboutsummaryrefslogtreecommitdiff
path: root/drawing
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-04-13 00:49:14 +0100
committerubq323 <ubq323@ubq323.website>2024-04-13 00:49:14 +0100
commitbf03e2a0d86a4b5202a72aa66da5dc0e2c0b412b (patch)
treeda47f07c9f3c7946044153f21b7d4bcf991ea1bf /drawing
parent0eeff114b44ccdd6bc430bc5f9583e2a3eea9823 (diff)
multiple packet types. code quality is declining steadily
Diffstat (limited to 'drawing')
-rw-r--r--drawing/op.ha8
1 files changed, 4 insertions, 4 deletions
diff --git a/drawing/op.ha b/drawing/op.ha
index deda81c..acbca29 100644
--- a/drawing/op.ha
+++ b/drawing/op.ha
@@ -7,13 +7,13 @@ export type op_other = void;
export type op = (op_circle| op_other);
-
-export fn send_op(file: io::handle, op: op) (void | io::error) = {
- static let buf: [8]u8 = [0...];
+// return value must be freed... for now. ehh
+export fn ser_op(op: op) []u8 = {
const opc = op as op_circle;
+ let buf: []u8 = alloc([0...],8);
endian::leputu32(buf[0..4], opc.0: u32);
endian::leputu32(buf[4..8], opc.1: u32);
- io::writeall(file, buf)?;
+ return buf;
};
export fn deser_op(bytes: []u8) op = {