1 #include <source/utility.hxx>
7 const char* const file
,
12 size_t chars
= snprintf(buf
, len
, "%s:%d: ", file
, line
);
14 // If buffer was too small, chars contains length
15 // of chars that would've been written. Chars must
16 // be lower than length or else we could not fit
17 // the message into buffer, too.
18 bool didFitIntoBuffer
= chars
< len
;
20 if (didFitIntoBuffer
) {
21 size_t newLength
= len
- chars
;
22 char* const newBuffer
= buf
+ chars
;
23 chars
= vsnprintf(newBuffer
, newLength
, msg
, ap
);
24 didFitIntoBuffer
= chars
<= newLength
;
27 return didFitIntoBuffer
;
33 const char* const file
,
35 const char* const msg
,
41 bool result
= vformat(buf
, len
, file
, line
, msg
, ap
);