From f868d02b08688c04509d1abda5af89a182033d88 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 21 Nov 2024 13:00:53 -0500 Subject: Add `NULL` as a syntax for null values. --- stdlib/optionals.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'stdlib') diff --git a/stdlib/optionals.c b/stdlib/optionals.c index 34f14f4b..b6a5989e 100644 --- a/stdlib/optionals.c +++ b/stdlib/optionals.c @@ -64,18 +64,14 @@ public PUREFUNC bool is_null(const void *obj, const TypeInfo_t *non_optional_typ } } -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstack-protector" public Text_t Optional$as_text(const void *obj, bool colorize, const TypeInfo_t *type) { if (!obj) return Text$concat(generic_as_text(obj, colorize, type->OptionalInfo.type), Text("?")); if (is_null(obj, type->OptionalInfo.type)) - return Text$concat(colorize ? Text("\x1b[31m!") : Text("!"), generic_as_text(NULL, false, type->OptionalInfo.type), - colorize ? Text("\x1b[m") : Text("")); - return Text$concat(generic_as_text(obj, colorize, type->OptionalInfo.type), colorize ? Text("\x1b[33m?\x1b[m") : Text("?")); + return colorize ? Text("\x1b[31mNULL\x1b[m") : Text("NULL"); + return generic_as_text(obj, colorize, type->OptionalInfo.type); } -#pragma GCC diagnostic pop // vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1 -- cgit v1.2.3