1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-22 03:07:41 +00:00

Make amalgamtion the default when building.

This way we can support fewer build configurations. Also, remove
all undefined behavior due to use of memcpy with NULL pointers. GCC
was exploiting this to remove NULL checks in some builds.
This commit is contained in:
Calvin Rose
2020-01-28 23:38:52 -06:00
parent f7b7c83264
commit 333ae7c4f8
28 changed files with 345 additions and 488 deletions

View File

@@ -713,7 +713,7 @@ JanetFuncDef *janetc_pop_funcdef(JanetCompiler *c) {
if (NULL == def->bytecode) {
JANET_OUT_OF_MEMORY;
}
memcpy(def->bytecode, c->buffer + scope->bytecode_start, s);
safe_memcpy(def->bytecode, c->buffer + scope->bytecode_start, s);
janet_v__cnt(c->buffer) = scope->bytecode_start;
if (NULL != c->mapbuffer && c->source) {
size_t s = sizeof(JanetSourceMapping) * (size_t) def->bytecode_length;
@@ -721,7 +721,7 @@ JanetFuncDef *janetc_pop_funcdef(JanetCompiler *c) {
if (NULL == def->sourcemap) {
JANET_OUT_OF_MEMORY;
}
memcpy(def->sourcemap, c->mapbuffer + scope->bytecode_start, s);
safe_memcpy(def->sourcemap, c->mapbuffer + scope->bytecode_start, s);
janet_v__cnt(c->mapbuffer) = scope->bytecode_start;
}
}