Alexander Amelkin 8e4459f3dc
Refactor to reduce complexity of dict print funcs
Dictionary print functions (print_valstr, print_valstr_2col,
dcmi_print_strs) are used in various modules and are excessively
complex. One of the reasons is support for loglevel -1, which means
printing to STDOUT. Another reason is support in dcmi_print_strs()
for so called 'horizontal printing' when only strings without
descriptions are printed in one line with separators.

Horizontal printing was in fact broken as dcmi_print_strs() was
always called with loglevel set to LOG_ERR, which resulted in using
lprintf() that adds a '\n' at the end of each printout.

This commit:
* Fixes horizontal printout for dcmi_print_strs();
* Reduces complexity of all three functions by introducing
  a macro helper called uprintf() that automatically chooses
  either printf() or lprintf() based on the selected loglevel;

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2019-08-30 13:42:17 +03:00
..