MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / printf

Method printf

libraries/AP_Common/ExpandingString.cpp:68–97  ·  view source on GitHub ↗

print into the buffer, expanding if needed */

Source from the content-addressed store, hash-verified

66 print into the buffer, expanding if needed
67 */
68void ExpandingString::printf(const char *format, ...)
69{
70 if (allocation_failed) {
71 return;
72 }
73 if (buflen == used && !expand(0)) {
74 return;
75 }
76 int n;
77
78 /*
79 print into the buffer, expanding the buffer if needed
80 */
81 while (true) {
82 va_list arg;
83 va_start(arg, format);
84 n = hal.util->vsnprintf(&buf[used], buflen-used, format, arg);
85 va_end(arg);
86 if (n < 0) {
87 return;
88 }
89 if (uint32_t(n) < buflen - used) {
90 break;
91 }
92 if (!expand(n+1)) {
93 return;
94 }
95 }
96 used += n;
97}
98
99/*
100 print into the buffer, expanding if needed

Callers 12

~TestMethod · 0.45
requireMethod · 0.45
reportMethod · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
test_high_low_byteFunction · 0.45
setupFunction · 0.45
_calibrateMethod · 0.45
setupFunction · 0.45
setupFunction · 0.45
loopFunction · 0.45
check_firmware_printFunction · 0.45

Calls 1

vsnprintfMethod · 0.45

Tested by 9

~TestMethod · 0.36
requireMethod · 0.36
reportMethod · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
test_high_low_byteFunction · 0.36
setupFunction · 0.36
setupFunction · 0.36
loopFunction · 0.36