AccessLogFileData::AccessLogFileData(const std::string& fil, const std::string& lnk, const std::string& fmt, int mpl) : file(fil) , symLink(lnk) , format(fmt) , periodMultiplier(mpl) { /* * a LogWriter with it's format can be selected between colons like: * Format = :thrift: [["%{%s}t", "out-name", "STRING"], ...] */ m_logOutputType = ClassicWriter::handle; auto fmt_ = folly::StringPiece(fmt); while (!fmt_.empty() && std::isspace(fmt_.front())) fmt_.pop_front(); if (fmt_.removePrefix(':')) { size_t close = fmt_.find(':'); if (close != fmt_.npos) { m_logOutputType = fmt_.subpiece(0, close).str(); fmt_.advance(close + 1); format = folly::trimWhitespace(fmt_).str(); } } }
/* * Construct effects for member instructions that take &tvRef as their last * argument. * * These instructions never load tvRef, but they might store to it. */ MemEffects minstr_with_tvref(const IRInstruction& inst) { auto const srcs = inst.srcs(); assertx(srcs.back()->isA(TPtrToMISGen)); return may_raise( inst, may_load_store( AHeapAny | all_pointees(srcs.subpiece(0, srcs.size() - 1)), AHeapAny | all_pointees(inst) ) ); }
/* * Writes a file path to a file while folding any consecutive forward slashes. */ void write_path(int fd, folly::StringPiece path) { while (!path.empty()) { auto const pos = path.find('/'); if (pos == std::string::npos) { folly::writeNoInt(fd, path.data(), path.size()); break; } auto const left = path.subpiece(0, pos + 1); folly::writeNoInt(fd, left.data(), left.size()); auto right = path.subpiece(pos); while (!right.empty() && right[0] == '/') { right = right.subpiece(1); } path = right; } }