Use local variables in functions

This will avoid undesired side-effects.
Make get_allocated_nodes always set get_allocated_nodes_retval as retval

The old code was broken because the name of the variable passed to
get_allocated_nodes to save the result should not be used inside the
function; but it was...
Fix log in get_allocated_nodes to mention role
Merge pull request #20 from rhafer/fix-variables-mess

Make get_allocated_nodes always set get_allocated_nodes_retval as retval