hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit aff104e64c42129c2a7eef3680840049c775618e
parent 11246a9b286ca851530ba9ae1998289f4cfbf83b
Author: Drew DeVault <sir@cmpwn.com>
Date:   Wed, 11 May 2022 14:27:01 +0200

encoding::json: clarify ownership semantics of set

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Mencoding/json/value.ha | 6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/encoding/json/value.ha b/encoding/json/value.ha @@ -31,8 +31,8 @@ export fn get(obj: *object, key: str) (*value | void) = { }; }; -// Sets a value in a JSON object. Assumes ownership over the provided value. -export fn set(obj: *object, key: str, val: value) void = { +// Sets a value in a JSON object. +export fn set(obj: *object, key: const str, val: const value) void = { const hash = fnv::string64(key): size; const bucket = &obj.buckets[hash % len(obj.buckets)]; for (let i = 0z; i < len(bucket); i += 1) { @@ -46,7 +46,7 @@ export fn set(obj: *object, key: str, val: value) void = { }; // Deletes a value from a JSON object. -export fn del(obj: *object, key: str) void = { +export fn del(obj: *object, key: const str) void = { const hash = fnv::string64(key): size; const bucket = &obj.buckets[hash % len(obj.buckets)]; for (let i = 0z; i < len(bucket); i += 1) {