Fix variable names generated for <entry>

Before this commit, variable names generation for <entry> didn't
consider namespace and locality/globality of the variable.