Beatutiful +1 Acked-by: Chengwen Feng <fengcheng...@huawei.com>
On 2023/2/8 22:37, Bruce Richardson wrote: > When printing values as hex strings, the telemetry code temporarily > disabled warnings about non-literal format strings. This was because the > actual format string was built-up programmatically to ensure the output > was of the desired bitwidth. > > However, this code can be reworked and shortened by taking advantage of > the "*" printf flag, which is used to specify that the output width is > given by a separate printf parameter. This allows the format to be a > literal string in all cases, and also allows the code in the function to > be shortened considerably. > > Note: the type of the width should be an "int" variable, which is why > this patch changes the type of the existing variable. Also, while we > could shorten the format string by using the "#" flag in place of an > explicit "0x", this would make the code more confusing because it would > mean that the "0x" would be included in the specified with, forcing us > to add 2 to the existing computed width. > > Signed-off-by: Bruce Richardson <bruce.richard...@intel.com> > --- ...