diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-10-12 14:19:59 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-10-12 14:19:59 -0400 |
| commit | 6e5fb2ac4e5b780c74f310446ddd80d571170b0d (patch) | |
| tree | 587241a69065c01b890d7ae70a37af08bba646b1 /src/stdlib/tables.c | |
| parent | 3cd3b20f58e9d2c6463d503be09e5d4cfaadee6c (diff) | |
More code cleanups
Diffstat (limited to 'src/stdlib/tables.c')
| -rw-r--r-- | src/stdlib/tables.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/stdlib/tables.c b/src/stdlib/tables.c index 3c78b770..45e3abb4 100644 --- a/src/stdlib/tables.c +++ b/src/stdlib/tables.c @@ -732,20 +732,20 @@ void Table$serialize(const void *obj, FILE *out, Table_t *pointers, const TypeIn if (t->fallback) Table$serialize(t->fallback, out, pointers, type); } -#ifdef __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstack-protector" -#endif public void Table$deserialize(FILE *in, void *outval, List_t *pointers, const TypeInfo_t *type) { int64_t len; Int64$deserialize(in, &len, pointers, &Int$info); Table_t t = EMPTY_TABLE; + char keybuf[256], valbuf[256]; + char *key = + (size_t)type->TableInfo.key->size <= sizeof(keybuf) ? keybuf : GC_MALLOC((size_t)type->TableInfo.key->size); + char *value = + (size_t)type->TableInfo.value->size <= sizeof(valbuf) ? valbuf : GC_MALLOC((size_t)type->TableInfo.value->size); + for (int64_t i = 0; i < len; i++) { - char key[type->TableInfo.key->size]; _deserialize(in, key, pointers, type->TableInfo.key); - char value[type->TableInfo.value->size]; if (type->TableInfo.value->size > 0) _deserialize(in, value, pointers, type->TableInfo.value); Table$set(&t, key, value, type); } @@ -757,6 +757,3 @@ void Table$deserialize(FILE *in, void *outval, List_t *pointers, const TypeInfo_ *(Table_t *)outval = t; } -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif |
