src/common.c: Reimplement format_name for performance.

This is used from uc_update(), i.e. for every value list dispatched, and was
one of the most expensive functions thanks to snprintf().

This reduces total time spent in the format_name() function from 7.78% to 1.89%
during a network stress test.