Fixed|libcommon: Build errors and warnings in p_map.cpp

Jumping over variable initialization with goto is illegal. Moved
the variables before the gotos.

Also, fixed warnings about usage of '=' in while conditions.