printing: simplify code where two paths do exactly the same thing

AFAICT, StrPrinter separates into two cases here but both of them
do the same thing.  Simplify the code.
CodePrinter has very similar code so fix same thing there too.
Merge pull request #8027 from cbm755/print_mul_fix

printing: simplify code where two paths do exactly the same thing