aboutsummaryrefslogtreecommitdiff
path: root/builtins
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-03-09 23:21:44 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-03-09 23:21:44 -0500
commitfcd1381e3d619b39d0830fc6019078a9282325b3 (patch)
tree9b5070435fa53121c804d0b162653285ce20e7eb /builtins
parentbeb929484b32eda79d0cc3f272120f1c852af296 (diff)
Minor cleanups to get compilation working on clang
Diffstat (limited to 'builtins')
-rw-r--r--builtins/array.c3
-rw-r--r--builtins/functions.c19
-rw-r--r--builtins/table.c3
3 files changed, 4 insertions, 21 deletions
diff --git a/builtins/array.c b/builtins/array.c
index 8ee771ea..07814f66 100644
--- a/builtins/array.c
+++ b/builtins/array.c
@@ -321,7 +321,8 @@ public uint32_t Array__hash(const array_t *arr, const TypeInfo *type)
const TypeInfo *item = type->ArrayInfo.item;
if (item->tag == PointerInfo || (item->tag == CustomInfo && item->CustomInfo.hash == NULL)) { // Raw data hash
int64_t item_size = item->size;
- uint8_t hash_batch[4 + 8*item_size] = {};
+ uint8_t hash_batch[4 + 8*item_size];
+ memset(hash_batch, 0, sizeof(hash_batch));
uint8_t *p = hash_batch, *end = hash_batch + sizeof(hash_batch);
int64_t length = arr->length;
*p = (uint32_t)length;
diff --git a/builtins/functions.c b/builtins/functions.c
index bcaf5d11..448b7758 100644
--- a/builtins/functions.c
+++ b/builtins/functions.c
@@ -130,25 +130,6 @@ public CORD builtin_last_err()
return CORD_from_char_star(strerror(errno));
}
-static inline char *without_colors(const char *str)
-{
- // Strip out color escape sequences: "\x1b[" ... "m"
- size_t fmt_len = strlen(str);
- char *buf = GC_malloc_atomic(fmt_len+1);
- char *dest = buf;
- for (const char *src = str; *src; ++src) {
- if (src[0] == '\x1b' && src[1] == '[') {
- src += 2;
- while (*src && *src != 'm')
- ++src;
- } else {
- *(dest++) = *src;
- }
- }
- *dest = '\0';
- return buf;
-}
-
public void __doctest(void *expr, const TypeInfo *type, CORD expected, const char *filename, int64_t start, int64_t end)
{
static file_t *file = NULL;
diff --git a/builtins/table.c b/builtins/table.c
index eb329c9c..5631a7fb 100644
--- a/builtins/table.c
+++ b/builtins/table.c
@@ -271,7 +271,8 @@ public void *Table_reserve(table_t *t, const void *key, const void *value, const
maybe_copy_on_write(t, type);
- char buf[entry_size(type)] = {};
+ char buf[entry_size(type)];
+ memset(buf, 0, sizeof(buf));
memcpy(buf, key, key_size);
if (value && value_size > 0)
memcpy(buf + value_offset(type), value, value_size);