factoring out CPPEscape to be a standalone function

This commit is contained in:
Vern Paxson 2021-11-07 16:57:52 -08:00
parent 14abfc6831
commit bc3bf4ea6c
2 changed files with 64 additions and 0 deletions

View file

@ -36,4 +36,12 @@ extern bool is_CPP_compilable(const ProfileFunc* pf, const char** reason = nullp
extern void lock_file(const std::string& fname, FILE* f);
extern void unlock_file(const std::string& fname, FILE* f);
// For the given byte array / string, returns a version expanded
// with escape sequences in order to represent it as a C++ string.
extern std::string CPPEscape(const char* b, int len);
inline std::string CPPEscape(const char* s)
{
return CPPEscape(s, strlen(s));
}
} // zeek::detail