commit d7574e17164d577891661c521cf26fafe240d620
parent 0c209140e81aa032d07362a4dc828e0721831368
Author: Bor Grošelj Simić <bgs@turminal.net>
Date: Wed, 27 Apr 2022 14:36:26 +0200
modules starting with a-e: docs fixes
Signed-off-by: Bor Grošelj Simić <bgs@turminal.net>
Diffstat:
14 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/bufio/memstream.ha b/bufio/memstream.ha
@@ -86,12 +86,12 @@ const dynamic_vt_rw: io::vtable = io::vtable {
...
};
-// Creates an [[io::stream]] which dynamically allocates a buffer to store writes
-// into. Subsequent reads will consume the buffered data. Upon failure to
+// Creates an [[io::stream]] which dynamically allocates a buffer to store
+// writes into. Subsequent reads will consume the buffered data. Upon failure to
// allocate sufficient memory to store writes, the program aborts.
//
-// Calling [[io::close]] on this stream will free the buffer. If stream's
-// data is transferred via [[buffer]], it shouldn't be closed as long as the
+// Calling [[io::close]] on this stream will free the buffer. If a stream's data
+// is transferred via [[buffer]], the stream shouldn't be closed as long as the
// data is freed.
export fn dynamic(mode: io::mode) memstream = dynamic_from([], mode);
diff --git a/bufio/scanner.ha b/bufio/scanner.ha
@@ -47,7 +47,7 @@ export fn scantok(file: io::handle, delim: u8...) ([]u8 | io::EOF | io::error) =
return buf;
};
-// Reads a slice of bytes until a newline character (\n, 0x10). Newline itself
+// Reads a slice of bytes until a newline character (\n, 0x0A). Newline itself
// is not included. The return value must be freed by the caller.
export fn scanline(file: io::handle) ([]u8 | io::EOF | io::error) =
scantok(file, '\n');
diff --git a/bytes/tokenize.ha b/bytes/tokenize.ha
@@ -41,7 +41,7 @@ case let b: []u8 =>
case => void;
};
-// Same as next_token(), but does not advance the cursor
+// Same as [[next_token]], but does not advance the cursor
export fn peek_token(s: *tokenizer) ([]u8 | void) = {
if (len(s.d) == 0) {
return;
@@ -118,9 +118,9 @@ export fn remaining_tokens(s: *tokenizer) []u8 = {
assert(next_token(&t) is void);
};
-// Returns a the slice "cut" along the first instance of a delimiter, returning
-// everything up to the delimiter, and everything after the delimiter, in a
-// tuple.
+// Returns the input slice "cut" along the first instance of a delimiter,
+// returning everything up to the delimiter, and everything after the delimiter,
+// in a tuple. The contents are borrowed from the input slice.
//
// The caller must ensure that 'delimiter' is not an empty slice.
export fn cut(in: []u8, delim: ([]u8 | u8)) ([]u8, []u8) = {
diff --git a/bytes/two_way.ha b/bytes/two_way.ha
@@ -3,7 +3,7 @@
use types;
// Implements the so called Two-way string matching algorithm by Crochemore and
-// Perrin. It preprocesses the needle in O(len(needle)) steps and performs the
+// Perrin. It pre-processes the needle in O(len(needle)) steps and performs the
// matching in O(len(haystack)) steps. It does so without any space overhead.
fn index_tw(haystack: []u8, needle: []u8) (size | void) = {
const n = len(haystack);
@@ -15,7 +15,7 @@ fn index_tw(haystack: []u8, needle: []u8) (size | void) = {
return if (equal(haystack, needle)) 0 else void;
};
- // preprocessing
+ // pre-processing
let tup1 = max_suf(needle, false);
let i = tup1.0, p = tup1.1;
let tup2 = max_suf(needle, true);
@@ -88,7 +88,7 @@ fn max_suf(x: []u8, inv: bool) (size, size) = {
j += 1;
k = 1;
p = 1;
- };
+ };
};
return (i, p);
};
diff --git a/crypto/blake2b/blake2b.ha b/crypto/blake2b/blake2b.ha
@@ -57,7 +57,7 @@ const blake2b_vtable: io::vtable = io::vtable {
// Creates a [[hash::hash]] which computes a BLAKE2b hash with a given key and a
// given hash size. The size must be between 1 and 64, inclusive. If this
// function is used to hash sensitive information, the caller should call
-// [[hash::close]] to erase sentitive data from memory after use; if not, the
+// [[hash::close]] to erase sensitive data from memory after use; if not, the
// use of [[hash::close]] is optional.
export fn blake2b(key: []u8, sz: size) digest = {
assert(1 <= sz);
diff --git a/crypto/blowfish/blowfish.ha b/crypto/blowfish/blowfish.ha
@@ -192,7 +192,7 @@ fn decrypt(c: *state, l: u32, r: u32) (u32, u32) = {
return (xr, xl);
};
-// Gets the next word from b and updates the index, looping around in a cicular
+// Gets the next word from b and updates the index, looping around in a circular
// buffer.
fn getword(b: []u8, i: *size) u32 = {
let j = *i;
diff --git a/crypto/chacha/chacha20.ha b/crypto/chacha/chacha20.ha
@@ -20,7 +20,7 @@ export def BLOCKSIZE: size = 64;
def ROUNDS: size = 20;
const magic: [4]u32 = [0x61707865, 0x3320646e, 0x79622d32, 0x6b206574];
-// Create a Chacha20 or XChacha20 stream. Needs to be initalized with either
+// Create a Chacha20 or XChacha20 stream. Needs to be initialized with either
// [[chacha20_init]] or [[xchacha20_init]]. It must be finished with
// [[crypto::cipher::finish]].
export type stream = struct {
diff --git a/crypto/salsa/salsa20.ha b/crypto/salsa/salsa20.ha
@@ -29,7 +29,7 @@ export type stream = struct {
rounds: size,
};
-// Create a Salsa20 or XSalsa20 stream. Must be initalized with either
+// Create a Salsa20 or XSalsa20 stream. Must be initialized with either
// [[salsa20_init]] or [[xsalsa20_init]], and must be finished with
// [[crypto::cipher::finish]] afterwards to wipe sensitive data from memory.
export fn salsa20() stream = {
diff --git a/crypto/sha1/sha1.ha b/crypto/sha1/sha1.ha
@@ -36,10 +36,10 @@ const sha1_vtable: io::vtable = io::vtable {
};
// Creates a [[hash::hash]] which computes a SHA-1 hash. Note that this
-// alogorithm is no longer considered secure. Where possible, applications are
+// algorithm is no longer considered secure. Where possible, applications are
// encouraged to use [[crypto::sha256]] or [[crypto::sha512]] instead. If this
// function is used to hash sensitive information, the caller should call
-// [[hash::close]] to erase sentitive data from memory after use; if not, the
+// [[hash::close]] to erase sensitive data from memory after use; if not, the
// use of [[hash::close]] is optional.
export fn sha1() state = {
let sha = state {
diff --git a/crypto/sha256/sha256.ha b/crypto/sha256/sha256.ha
@@ -54,7 +54,7 @@ const sha256_vtable: io::vtable = io::vtable {
// Creates a [[hash::hash]] which computes a SHA-256 hash. If this function is
// used to hash sensitive information, the caller should call [[hash::close]] to
-// erase sentitive data from memory after use; if not, the use of
+// erase sensitive data from memory after use; if not, the use of
// [[hash::close]] is optional.
export fn sha256() state = {
let sha = state {
diff --git a/crypto/sha512/sha512.ha b/crypto/sha512/sha512.ha
@@ -74,25 +74,25 @@ export type digest = struct {
// Creates a [[hash::hash]] which computes a SHA-512 hash. If this function is
// used to hash sensitive information, the caller should call [[hash::close]] to
-// erase sentitive data from memory after use; if not, the use of
+// erase sensitive data from memory after use; if not, the use of
// [[hash::close]] is optional.
export fn sha512() digest = init(variant::SHA512, SIZE);
// Creates a [[hash::hash]] which computes a SHA-512/224 hash. If this function
// is used to hash sensitive information, the caller should call [[hash::close]]
-// to erase sentitive data from memory after use; if not, the use of
+// to erase sensitive data from memory after use; if not, the use of
// [[hash::close]] is optional.
export fn sha512_224() digest = init(variant::SHA512_224, SIZE224);
// Creates a [[hash::hash]] which computes a SHA-512/256 hash. If this function
// is used to hash sensitive information, the caller should call [[hash::close]]
-// to erase sentitive data from memory after use; if not, the use of
+// to erase sensitive data from memory after use; if not, the use of
// [[hash::close]] is optional.
export fn sha512_256() digest = init(variant::SHA512_256, SIZE256);
// Creates a [[hash::hash]] which computes a SHA-384 hash. If this function is
// used to hash sensitive information, the caller should call [[hash::close]] to
-// erase sentitive data from memory after use; if not, the use of
+// erase sensitive data from memory after use; if not, the use of
// [[hash::close]] is optional.
export fn sha384() digest = init(variant::SHA384, SIZE384);
diff --git a/datetime/chronology.ha b/datetime/chronology.ha
@@ -4,7 +4,7 @@ use errors;
use time;
use time::chrono;
-// Fucntions renamed here to avoid namespace conflict, like in the parameters of
+// Functions renamed here to avoid namespace conflict, like in the parameters of
// the [[new]] function.
// Returns a [[datetime]]'s number of days since the calendar epoch 0000-01-01
diff --git a/format/elf/types.ha b/format/elf/types.ha
@@ -845,7 +845,7 @@ export type dt = enum i64 {
HIPROC = 0x7FFFFFFF,
};
-// Auxillary vector
+// Auxiliary vector
export type auxv64 = struct {
// Entry type
a_type: at,
@@ -857,7 +857,7 @@ export type auxv64 = struct {
}
};
-// Legal auxillary vector entry types
+// Legal auxiliary vector entry types
export type at = enum u64 {
// End of vector
NULL = 0,
@@ -968,7 +968,7 @@ export type verdef64 = struct {
vd_next: u32,
};
-// Auxillary version information
+// Auxiliary version information
export type verdaux64 = struct {
vda_name: u32,
vda_next: u32,
diff --git a/format/ini/types.ha b/format/ini/types.ha
@@ -6,7 +6,7 @@ use encoding::utf8;
use fmt;
use io;
-// A syntax error occured during parsing.
+// A syntax error occurred during parsing.
export type syntaxerr = !size;
// Any error that may occur during parsing.