extensions
Volodymyr Shymanskyy 5 years ago
parent 5e33aa2fde
commit 2f9af59a99

@ -262,6 +262,9 @@ M3Result m3_LinkFunction (IM3Module io_module, const char * const i_functionN
M3ArgPusher pushers [c_m3MaxNumFunctionArgs + 1];
u8 signature [1 /* return */ + c_m3MaxNumFunctionArgs + 2];
M3_INIT(pushers);
M3_INIT(signature);
IM3Function func = (IM3Function) v_FindFunction (io_module, i_functionName);
if (func)
{

@ -52,6 +52,7 @@ const void * const cvptr_t;
# define M3_WEAK __attribute__((weak))
# endif
#define M3_INIT(field) memset(&field, 0, sizeof(field))
static const char * m3LogTruncFilename (const char * i_file)
{

@ -146,7 +146,9 @@ M3Result EvaluateExpression (IM3Module i_module, void * o_expressed, u8 i_type
u64 stack [c_m3MaxFunctionStackHeight]; // stack on the stack
// create a temporary runtime context
M3Runtime rt = {};
M3Runtime rt;
M3_INIT(rt);
rt.numStackSlots = c_m3MaxFunctionStackHeight;
rt.stack = & stack;
@ -603,7 +605,9 @@ M3ErrorInfo m3_GetErrorInfo (IM3Runtime i_runtime)
{
M3ErrorInfo info = i_runtime->error;
M3ErrorInfo reset = {};
M3ErrorInfo reset;
M3_INIT(reset);
i_runtime->error = reset;
return info;

@ -22,12 +22,11 @@
void m3_printf (cstr_t i_format, const void * i_varArgs)
{
const size_t c_bufferLength = 1000;
char format [c_bufferLength];
char output [c_bufferLength];
char format [256];
char output [256];
size_t formatLength = strlen (i_format) + 1;
char * buffer = formatLength <= c_bufferLength ? format : (char*)malloc (formatLength);
char * buffer = formatLength <= sizeof(format) ? format : (char*)malloc (formatLength);
size_t numArgs = 0;
char * p = 0;

@ -135,7 +135,8 @@ OpInfo;
OpInfo FindOperationInfo (IM3Operation i_operation)
{
OpInfo opInfo = {};
OpInfo opInfo;
M3_INIT(opInfo);
for (u32 i = 0; i <= 0xff; ++i)
{

@ -109,7 +109,9 @@ M3Result ParseSection_Import (IM3Module io_module, bytes_t i_bytes, cbytes_t i
{
M3Result result = c_m3Err_none;
M3ImportInfo import = {}, clearImport = {};
M3ImportInfo import, clearImport;
M3_INIT(import);
M3_INIT(clearImport);
u32 numImports;
_ (ReadLEB_u32 (& numImports, & i_bytes, i_end)); m3log (parse, "** Import [%d]", numImports);

Loading…
Cancel
Save