9front - general discussion about 9front
 help / color / mirror / Atom feed
From: "Matt Carroll" <oholiab@grimmwa.re>
To: <9front@9front.org>
Subject: Re: [9front] [PATCH] Fix rune size in `acid`
Date: Wed, 03 May 2023 20:05:32 +0100	[thread overview]
Message-ID: <CSCVLE6XBX2N.880CWFDWGLKB@meagr> (raw)
In-Reply-To: <CSCVDAR396SF.1AAIPVAPPFHLL@meagr>

On Wed May 3, 2023 at 7:54 PM BST, Matt Carroll wrote:
> On Wed May 3, 2023 at 6:54 PM BST,  wrote:
> >
> > why make rsize a variable? seems like you could just directly
> > use sizeof(Rune).
>
> I misremembered sizeof being runtime instead of compile time, I'll fix
> it up and send another patch.

diff 54fdc350d67ae00ee7f63450d178daf8f2095abd uncommitted
--- a/sys/src/cmd/acid/exec.c
+++ b/sys/src/cmd/acid/exec.c
@@ -264,7 +264,6 @@
 	case 'u':
 	case 'o':
 	case 'q':
-	case 'r':
 		r->type = TINT;
 		ret = get2(m, addr, &sval);
 		if (ret < 0)
@@ -286,6 +285,7 @@
 	case 'U':
 	case 'O':
 	case 'Q':
+	case 'r':
 		r->type = TINT;
 		ret = get4(m, addr, &lval);
 		if (ret < 0)
@@ -318,11 +318,11 @@
 		break;
 	case 'R':
 		r->type = TSTRING;
-		for(i = 0; i < sizeof(buf)-2; i += 2) {
-			ret = get1(m, addr, (uchar*)&buf[i], 2);
+		for(i = 0; i < sizeof(buf)-sizeof(Rune); i += sizeof(Rune)) {
+			ret = get1(m, addr, (uchar*)&buf[i], sizeof(Rune));
 			if (ret < 0)
 				error("indir: %r");
-			addr += 2;
+			addr += sizeof(Rune);
 			if(buf[i] == 0 && buf[i+1] == 0)
 				break;
 		}


      reply	other threads:[~2023-05-03 19:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-23 13:53 grimmware
2023-05-03 17:54 ` ori
2023-05-03 18:54   ` Matt Carroll
2023-05-03 19:05     ` Matt Carroll [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CSCVLE6XBX2N.880CWFDWGLKB@meagr \
    --to=oholiab@grimmwa.re \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).