diff options
Diffstat (limited to 'builtins')
| -rw-r--r-- | builtins/c_string.c | 9 | ||||
| -rw-r--r-- | builtins/c_string.h | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/builtins/c_string.c b/builtins/c_string.c index c7c7a563..bda127f0 100644 --- a/builtins/c_string.c +++ b/builtins/c_string.c @@ -13,14 +13,19 @@ #include "types.h" #include "util.h" -public Text_t CString$as_text(const void *c_string, bool colorize, const TypeInfo *info) +public Text_t CString$as_text(const char **c_string, bool colorize, const TypeInfo *info) { (void)info; if (!c_string) return Text("CString"); - Text_t text = Text$from_str(*(char**)c_string); + Text_t text = Text$from_str(*c_string); return Text$concat(colorize ? Text("\x1b[34mCString\x1b[m(") : Text("CString("), Text$quoted(text, colorize), Text(")")); } +public Text_t CString$as_text_simple(const char *str) +{ + return Text$format("%s", str); +} + PUREFUNC public int32_t CString$compare(const char **x, const char **y) { if (x == y) diff --git a/builtins/c_string.h b/builtins/c_string.h index 10621e62..e596bf40 100644 --- a/builtins/c_string.h +++ b/builtins/c_string.h @@ -8,7 +8,8 @@ #include "types.h" -Text_t CString$as_text(const void *str, bool colorize, const TypeInfo *info); +Text_t CString$as_text(char **str, bool colorize, const TypeInfo *info); +Text_t CString$as_text_simple(const char *str); PUREFUNC int CString$compare(const char **x, const char **y); PUREFUNC bool CString$equal(const char **x, const char **y); PUREFUNC uint64_t CString$hash(const char **str); |
