27 int dprintf(
int fd,
const char* fmt, ...) {
34 int ret = vsnprintf(
nullptr, 0, fmt, args);
38 size_t len = size_t(ret);
39 char* buf =
new char[len + 1];
43 if (
size_t(vsnprintf(buf, len + 1, fmt, args)) == len &&
44 write(fd, buf, len) == ssize_t(len)) {
56 return _popen(name, mode);
59 void setbuffer(
FILE*
f,
char* buf,
size_t size) {
60 setvbuf(f, buf, _IOFBF, size);
63 int vasprintf(
char**
dest,
const char*
format, va_list ap) {
64 int len = vsnprintf(
nullptr, 0, format, ap);
68 char* buf = *dest = (
char*)malloc(
size_t(len + 1));
69 if (vsnprintf(buf,
size_t(len + 1), format, ap) == len) {
void write(const T &in, folly::io::Appender &appender)
folly::Optional< PskKeyExchangeMode > mode
constexpr auto size(C const &c) -> decltype(c.size())
Formatter< false, Args... > format(StringPiece fmt, Args &&...args)
GMockOutputTest ExpectedCall FILE