Print spaces for padding. Ignores negative counts. */
| 116 | |
| 117 | /* Print spaces for padding. Ignores negative counts. */ |
| 118 | static int print_spaces(int count, struct printf_spec *ps) |
| 119 | { |
| 120 | int tmp, ret; |
| 121 | char buffer[PRINT_BUFFER_SIZE]; |
| 122 | |
| 123 | if (count <= 0) |
| 124 | return 0; |
| 125 | |
| 126 | memset(buffer, ' ', MIN(PRINT_BUFFER_SIZE, count)); |
| 127 | for (tmp = count; tmp > PRINT_BUFFER_SIZE; tmp -= PRINT_BUFFER_SIZE) |
| 128 | if ((ret = printf_putnchars(buffer, PRINT_BUFFER_SIZE, ps)) < 0) |
| 129 | return ret; |
| 130 | |
| 131 | if ((ret = printf_putnchars(buffer, tmp, ps)) < 0) |
| 132 | return ret; |
| 133 | |
| 134 | return count; |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * Print one formatted character. |
no test coverage detected