Rework parse_name() so that variable declaration is separate from function
based initialisation, use more readable variable names and use a goto
rather than duplicating the frees for the error and non-error paths...

ok beck@