~sircmpwn/hare-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH hare-json] Update for hare as of 20230813

Details
Message ID
<20230918072800.15417-1-contact+sr.ht@hacktivis.me>
DKIM signature
missing
Download raw message
Patch: +5 -4
From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>

---
 encoding/json/+test/lexer.ha | 5 +++--
 encoding/json/+test/load.ha  | 2 +-
 encoding/json/lex.ha         | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/encoding/json/+test/lexer.ha b/encoding/json/+test/lexer.ha
index 499d315..019e64c 100644
--- a/encoding/json/+test/lexer.ha
+++ b/encoding/json/+test/lexer.ha
@@ -1,4 +1,4 @@
use bufio;
use memio;
use strings;
use io;

@@ -22,7 +22,8 @@ use io;

	for (let i = 0z; i < len(cases); i += 1) {
		const src = strings::toutf8(cases[i].0);
		const src = bufio::fixed(src, io::mode::READ);
		const src = memio::fixed(src);
		defer io::close(&src)!;
		const lexer = newlexer(&src);
		defer close(&lexer);

diff --git a/encoding/json/+test/load.ha b/encoding/json/+test/load.ha
index 074860f..bf53777 100644
--- a/encoding/json/+test/load.ha
+++ b/encoding/json/+test/load.ha
@@ -52,7 +52,7 @@ fn errassert(input: str, expected_loc: (uint, uint)) void = {
	roundtrip(`{"foo\u0000bar": 42}`, obj);
	reset(&obj);
	set(&obj, "min", -1.0e+28);
	set(&obj, "max", +1.0e+28);
	set(&obj, "max", 1.0e+28);
	roundtrip(`{"min": -1.0e+28, "max": 1.0e+28}`, obj);
	reset(&obj);
	set(&obj, "id", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
diff --git a/encoding/json/lex.ha b/encoding/json/lex.ha
index a523db1..3d20101 100644
--- a/encoding/json/lex.ha
+++ b/encoding/json/lex.ha
@@ -24,7 +24,7 @@ export type lexer = struct {
// Creates a new JSON lexer. The caller may obtain tokens with [[lex]] and
// should pass the result to [[close]] when they're done with it.
export fn newlexer(src: io::handle) lexer = {
	let buf: []u8 = alloc([0...], os::BUFSZ);
	let buf: []u8 = alloc([0...], os::BUFSIZ);
	return lexer {
		src = src,
		buffer = buf,
-- 
2.41.0
Details
Message ID
<CVLVBXY6V61N.15809WKQCSDLF@framework>
In-Reply-To
<20230918072800.15417-1-contact+sr.ht@hacktivis.me> (view parent)
DKIM signature
missing
Download raw message
On Mon Sep 18, 2023 at 9:28 AM CEST,  wrote:
> From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
> diff --git a/encoding/json/lex.ha b/encoding/json/lex.ha
> index a523db1..3d20101 100644
> --- a/encoding/json/lex.ha
> +++ b/encoding/json/lex.ha
> @@ -24,7 +24,7 @@ export type lexer = struct {
>  // Creates a new JSON lexer. The caller may obtain tokens with [[lex]] and
>  // should pass the result to [[close]] when they're done with it.
>  export fn newlexer(src: io::handle) lexer = {
> -	let buf: []u8 = alloc([0...], os::BUFSZ);
> +	let buf: []u8 = alloc([0...], os::BUFSIZ);

This should be the other way around. BUFSZ is the new name.
Reply to thread Export thread (mbox)