From 9b7ca9eabf546a1bb75956867dfe713bfc5af0f4 Mon Sep 17 00:00:00 2001 From: Luis <42945842+ldiaz94@users.noreply.github.com> Date: Sat, 17 Oct 2026 09:32:05 +0000 Subject: [PATCH] Buf.bytes and Sys.entryKind take const (report 2026-10.33) The seed no longer compiles Buf and Sys, so the two that only read their record take it as const, as the rest of the library does. No caller changes. --- diff --git a/doc/raz-lib.md b/doc/raz-lib.md index e155e1e..41a00bd 100644 --- a/doc/raz-lib.md +++ b/doc/raz-lib.md @@ -268,7 +268,7 @@ proc openDir*(var d: Dir; path: []U8): INT; proc nextEntry*(var d: Dir): ([]U8, BOOL); (* a name, good until the next call; false at the end *) -proc entryKind*(var d: Dir): Kind; (* what the name nextEntry gave last is *) +proc entryKind*(const d: Dir): Kind; (* what the name nextEntry gave last is *) proc closeDir*(var d: Dir); proc rawMode*(fd: INT): BOOL; (* the terminal on fd: no echo, no lines, no signals *) @@ -625,7 +625,7 @@ proc add*(var b: Buf; c: U8); proc str*(var b: Buf; s: []U8); proc spare*(var b: Buf; n: INT): []U8; (* room for n more bytes, and those bytes, to fill *) -proc bytes*(b: Buf): []U8; (* what it holds, until it next grows *) +proc bytes*(const b: Buf): []U8; (* what it holds, until it next grows *) proc cut*(var b: Buf; n: INT); (* only the first n bytes kept, its memory kept *) proc reset*(var b: Buf); (* emptied, its memory kept *) proc done*(var b: Buf); (* its memory given back *) diff --git a/lib/Buf.raz b/lib/Buf.raz index 5856310..11067ff 100644 --- a/lib/Buf.raz +++ b/lib/Buf.raz @@ -79,7 +79,7 @@ end; (* What the buffer holds, until it next grows. *) -proc bytes*(b: Buf): []U8; +proc bytes*(const b: Buf): []U8; begin if b.len = 0 then return ""; end; return b.data[0..b.len]; diff --git a/lib/Sys.linux-x86_64.raz b/lib/Sys.linux-x86_64.raz index 1f7ebf0..024102d 100644 --- a/lib/Sys.linux-x86_64.raz +++ b/lib/Sys.linux-x86_64.raz @@ -566,7 +566,7 @@ (* What the name nextEntry gave last is, as the directory says, so that a walk needn't ask each file with linkInfo; unknown where the file system doesn't say. A link is isLink, whatever it names. *) -proc entryKind*(var d: Dir): Kind; +proc entryKind*(const d: Dir): Kind; begin return d.kind; end; diff --git a/lib/Sys.raz b/lib/Sys.raz index d8cdba7..c61f380 100644 --- a/lib/Sys.raz +++ b/lib/Sys.raz @@ -629,7 +629,7 @@ (* What the name nextEntry gave last is, as the directory says, so that a walk needn't ask each file with linkInfo; unknown where the file system doesn't say. A link is isLink, whatever it names. *) -proc entryKind*(var d: Dir): Kind; +proc entryKind*(const d: Dir): Kind; begin return d.kind; end;