aboutsummaryrefslogtreecommitdiff
path: root/src/parse.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-04-03 15:19:59 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-04-03 15:19:59 -0400
commit8d173710fe8cfd96bd54f9dd1cf0eccacfdd6e73 (patch)
treee93cf2ad599ed1378366303d1162a60fec5090db /src/parse.c
parentcedae3039c8d67568b5ac35833c10cbfc1c7cb23 (diff)
Deprecate heap_strf
Diffstat (limited to 'src/parse.c')
-rw-r--r--src/parse.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/parse.c b/src/parse.c
index a3c68410..04e35953 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -246,7 +246,7 @@ static const char *unescape(parse_ctx_t *ctx, const char **out) {
if (escape[2+len] != ']')
parser_err(ctx, escape, escape + 2 + len, "Missing closing ']'");
*endpos = escape + 3 + len;
- return heap_strf("\033[%.*sm", len, &escape[2]);
+ return String("\033[", string_slice(&escape[2], len), "m");
} else if (escape[1] == '{') {
// Unicode codepoints by name
size_t len = strcspn(&escape[2], "\r\n}");
@@ -583,7 +583,7 @@ type_ast_t *parse_type_name(parse_ctx_t *ctx, const char *pos) {
if (!match(&next, ".")) break;
const char *next_id = get_id(&next);
if (!next_id) break;
- id = heap_strf("%s.%s", id, next_id);
+ id = String(id, ".", next_id);
pos = next;
}
return NewTypeAST(ctx->file, start, pos, VarTypeAST, .name=id);
@@ -852,7 +852,7 @@ ast_t *parse_field_suffix(parse_ctx_t *ctx, ast_t *lhs) {
bool dollar = match(&pos, "$");
const char* field = get_id(&pos);
if (!field) return NULL;
- if (dollar) field = heap_strf("$%s", field);
+ if (dollar) field = String("$", field);
return NewAST(ctx->file, lhs->start, pos, FieldAccess, .fielded=lhs, .field=field);
}
@@ -1349,7 +1349,7 @@ PARSER(parse_path) {
len += 1;
}
pos += len + 1;
- char *path = heap_strf("%.*s", (int)len, path_start);
+ char *path = String(string_slice(path_start, .length=len));
for (char *src = path, *dest = path; ; ) {
if (src[0] == '\\') {
*(dest++) = src[1];