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

Function eePRINTC

src/eepp/core/debug.cpp:127–158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127void eePRINTC( unsigned int cond, const char* format, ... ) {
128 if ( 0 == cond )
129 return;
130
131 int n, size = 2048;
132 std::string buf( size, '\0' );
133
134 va_list args;
135
136 va_start( args, format );
137
138 while ( 1 ) {
139 n = vsnprintf( &buf[0], buf.size(), format, args );
140
141 if ( n > -1 && n < size ) {
142 buf.resize( n );
143
144 printBuffer( buf, false );
145
146 va_end( args );
147
148 return;
149 }
150
151 if ( n > -1 ) // glibc 2.1
152 size = n + 1; // precisely what is needed
153 else // glibc 2.0
154 size *= 2; // twice the old size
155
156 buf.resize( size );
157 }
158}
159
160#endif
161

Callers 1

Calls 3

printBufferFunction · 0.85
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected