class StringPrefixes {
private:
std::set<pstring> pset;
- char* buf;
-private:
+
void addPrefix(char* startbuf, int n) {
std::set<pstring>::iterator elem = pset.find(pstring(startbuf, n));
bool replace = elem != pset.end() && n < elem->n;
StringPrefixes(const char* source);
bool contain(const char* s) {
- if (pset.find(pstring(s, strlen(s) + 1)) != pset.end()) {
- os::log("Backtrace for %s is enabled", s);
- return true;
- }
- return false;
+ return pset.find(pstring(s, strlen(s) + 1)) != pset.end();
}
};
namespace trace {
StringPrefixes::StringPrefixes(const char* source) {
- buf = (char*)malloc(sizeof(char) * PREFIX_BUF_SIZE);
+ char* buf = (char*)malloc(sizeof(char) * PREFIX_BUF_SIZE);
char* startbuf = buf;
int n = 0;
FILE* f = fopen(source, "r");
StringPrefixes::StringPrefixes(const char* source) {
- buf = (char*)malloc(sizeof(char) * PREFIX_BUF_SIZE);
+ char* buf = (char*)malloc(sizeof(char) * PREFIX_BUF_SIZE);
char* startbuf = buf;
int n = 0;
char* s = getenv(source);