From 3a872fb83fc14a2a07845941a5ad0ab4cb178d8d Mon Sep 17 00:00:00 2001 From: CPunch Date: Sun, 28 May 2023 00:08:28 -0500 Subject: [PATCH] these values can be defined at the top of the function --- src/cundump.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cundump.c b/src/cundump.c index 58f21bd..b6007ff 100644 --- a/src/cundump.c +++ b/src/cundump.c @@ -112,6 +112,9 @@ static bool readCObjString(UndumpState *udstate, CObjString **str) static bool readCObjFunction(UndumpState *udstate, CObjFunction **func) { + size_t constants; + CValue val; + *func = cosmoO_newFunction(udstate->state); check(readCObjString(udstate, &(*func)->name)); @@ -128,10 +131,8 @@ static bool readCObjFunction(UndumpState *udstate, CObjFunction **func) readVector(udstate, (void **)&(*func)->chunk.lineInfo, sizeof(int), &(*func)->chunk.count)); /* read constants */ - size_t constants; check(readSize(udstate, &constants)); for (int i = 0; i < constants; i++) { - CValue val; check(readCValue(udstate, &val)); addConstant(udstate->state, &(*func)->chunk, val); }