summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Weiner <hannes@cmpxchg.org>2010-05-12 19:32:22 +0200
committerJohannes Weiner <hannes@cmpxchg.org>2010-05-12 19:32:22 +0200
commit8089e5c69c120b85e96089e77d3451d169997fdc (patch)
treed55342a8926cd375ee1ffabd7fa31e34daad4a8f
parent1e70e852a0b786613f4c791b80fb1ab61239ddcf (diff)
alien: do not write return value location on error
Only actually write something through the passed in return value pointer when there is something meaningful. This makes it easier for `eval' to keep variables tight. Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
-rw-r--r--sheep/alien.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sheep/alien.c b/sheep/alien.c
index 18ab48b..869c1c8 100644
--- a/sheep/alien.c
+++ b/sheep/alien.c
@@ -19,11 +19,13 @@ static enum sheep_call alien_call(struct sheep_vm *vm, sheep_t callable,
unsigned int nr_args, sheep_t *valuep)
{
struct sheep_alien *alien;
+ sheep_t value;
alien = sheep_data(callable);
- *valuep = alien->function(vm, nr_args);
- if (!*valuep)
+ value = alien->function(vm, nr_args);
+ if (!value)
return SHEEP_CALL_FAIL;
+ *valuep = value;
return SHEEP_CALL_DONE;
}