MCPcopy Create free account
hub / github.com/SpartanJ/eepp / eePRINT

Function eePRINT

src/eepp/core/debug.cpp:67–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67void eePRINT( const char* format, ... ) {
68 int n, size = 2048;
69 std::string buf( size, '\0' );
70
71 va_list args;
72
73 va_start( args, format );
74
75 while ( 1 ) {
76 n = vsnprintf( &buf[0], buf.size(), format, args );
77
78 if ( n > -1 && n < size ) {
79 buf.resize( n );
80
81 printBuffer( buf, false );
82
83 va_end( args );
84
85 return;
86 }
87
88 if ( n > -1 ) // glibc 2.1
89 size = n + 1; // precisely what is needed
90 else // glibc 2.0
91 size *= 2; // twice the old size
92
93 buf.resize( size );
94 }
95}
96
97void eePRINTL( const char* format, ... ) {
98 int n, size = 2048;

Callers 1

showResultsMethod · 0.85

Calls 3

printBufferFunction · 0.85
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected