aboutsummaryrefslogtreecommitdiff
path: root/builtins/functions.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-03 15:00:28 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-03 15:00:28 -0400
commit82849ba783e2b8f8e3a040751cd964313470e7f2 (patch)
tree89380c5026b4da43d88658a5acf4d2c656ead8fe /builtins/functions.c
parent29a87ff325b5d9682593d66bd17964e5c2447510 (diff)
Use Text("...") literal constructor instead of Text$from_str("...")
function call.
Diffstat (limited to 'builtins/functions.c')
-rw-r--r--builtins/functions.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/builtins/functions.c b/builtins/functions.c
index 4aa699a5..3fbccf84 100644
--- a/builtins/functions.c
+++ b/builtins/functions.c
@@ -169,8 +169,8 @@ public Text_t generic_as_text(const void *obj, bool colorize, const TypeInfo *ty
case TableInfo: return Table$as_text(obj, colorize, type);
case TypeInfoInfo: return Type$as_text(obj, colorize, type);
case EmptyStruct: return colorize ?
- Text$concat(Text$from_str("\x1b[0;1m"), Text$from_str(type->EmptyStruct.name), Text$from_str("\x1b[m()"))
- : Text$concat(Text$from_str(type->EmptyStruct.name), Text$from_str("()"));
+ Text$concat(Text("\x1b[0;1m"), Text$from_str(type->EmptyStruct.name), Text("\x1b[m()"))
+ : Text$concat(Text$from_str(type->EmptyStruct.name), Text("()"));
case CustomInfo:
if (!type->CustomInfo.as_text)
fail("No text function provided for type!\n");
@@ -218,9 +218,9 @@ public void end_test(void *expr, const TypeInfo *type, const char *expected, con
Text_t expr_plain = USE_COLOR ? generic_as_text(expr, false, type) : expr_text;
bool success = Text$equal(&expr_plain, &expected_text);
if (!success) {
- Int_t colon = Text$find(expected_text, Text$from_str(":"), I_small(1), NULL);
+ Int_t colon = Text$find(expected_text, Text(":"), I_small(1), NULL);
if (colon.small != I_small(0).small) {
- Text_t with_type = Text$concat(expr_plain, Text$from_str(" : "), type_name);
+ Text_t with_type = Text$concat(expr_plain, Text(" : "), type_name);
success = Text$equal(&with_type, &expected_text);
}
}
@@ -256,7 +256,7 @@ public bool pop_flag(char **argv, int *i, const char *flag, Text_t *result)
*i += 1;
return true;
} else if (strncmp(argv[*i] + 2, "no-", 3) == 0 && streq(argv[*i] + 5, flag)) {
- *result = Text$from_str("no");
+ *result = Text("no");
argv[*i] = NULL;
*i += 1;
return true;