pttc: simplify expfilename()
pttc: simplify expfilename()

In expfilename() we compute a filename out of several optional components by
first computing the size of the resulting filename string and then
constructing the string by concatenating the individual pieces.

Change this to rely on snprintf() to construct the filename in a
stack-allocated buffer and then copy the string into a heap-allocated
buffer.

This requires an additional copy but simplifies the code a lot, especially
if we were to add the missing overflow checks for the length computation.

Change-Id: I8097bc4f488c7d2d23ce385630621c184a39faaa
Signed-off-by: Markus Metzger <5f675b2b36595f90898e014b548ff7d9bbff2ab7@intel.com>

01org/processor-trace,01org/processor-trace,01org/processor-trace