diff options
Diffstat (limited to 'builtins/c_string.c')
| -rw-r--r-- | builtins/c_string.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/builtins/c_string.c b/builtins/c_string.c index bd35b549..47ea4858 100644 --- a/builtins/c_string.c +++ b/builtins/c_string.c @@ -21,10 +21,14 @@ public Text_t CString$as_text(const void *c_string, bool colorize, const TypeInf return Text$concat(colorize ? Text("\x1b[34mCString\x1b[m(") : Text("CString("), Text$quoted(text, colorize), Text(")")); } -public int CString$compare(const char **x, const char **y) +public int32_t CString$compare(const char **x, const char **y) { + if (x == y) + return 0; + if (!*x != !*y) return (!*y) - (!*x); + return strcmp(*x, *y); } |
