From 51f7cb3a3b494bd38ad9b3aec72a32f7973b8a06 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Tue, 13 Aug 2013 15:34:39 +0100 Subject: Slight refactor of code initialising memory for argments/environment c-strings so that it is easier to read. --- lib/Core/Executor.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'lib/Core') diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp index b57b1956..184b0983 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -3219,24 +3219,20 @@ void Executor::runFunctionAsMain(Function *f, ObjectState *argvOS = bindObjectInState(*state, argvMO, false); for (int i=0; i=argc+1+envc) { - arg = 0; + // Write NULL pointer + argvOS->write(i * NumPtrBytes, Expr::createPointer(0)); } else { char *s = iallocate(len+1, false, true, state->pc->inst); + MemoryObject *arg = memory->allocate(len+1, false, true, state->pc->inst); ObjectState *os = bindObjectInState(*state, arg, false); for (j=0; jwrite8(j, s[j]); - } - if (arg) { + // Write pointer to newly allocated and initialised argv/envp c-string argvOS->write(i * NumPtrBytes, arg->getBaseExpr()); - } else { - argvOS->write(i * NumPtrBytes, Expr::createPointer(0)); } } } -- cgit 1.4.1