MCPcopy Create free account
hub / github.com/coreboot/coreboot / print_spaces

Function print_spaces

payloads/libpayload/libc/printf.c:118–135  ·  view source on GitHub ↗

Print spaces for padding. Ignores negative counts. */

Source from the content-addressed store, hash-verified

116
117/* Print spaces for padding. Ignores negative counts. */
118static 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.

Callers 3

print_charFunction · 0.85
print_stringFunction · 0.85
print_numberFunction · 0.85

Calls 2

printf_putncharsFunction · 0.85
memsetFunction · 0.50

Tested by

no test coverage detected