}
-char *
+const char *
StringParser::project_textrun(const char* org_textrun)
{
if (org_textrun == NULL || *org_textrun == '\0')
ret_text << off << '\t' << len << '\n' << '\0';
- string rettstr = ret_text.str();
- return (char *)rettstr.c_str();
+ static string rettstr = ret_text.str();
+ return rettstr.c_str();
}
-char *
+const char *
StringParser::hilite(const char* text, int n, const char* pats)
{
char* textrun = brute_force(text, n, pats);
if (textrun == NULL)
return NULL;
- char* prjed_textrun = project_textrun(textrun);
delete[] textrun;
+ const char* prjed_textrun = project_textrun(textrun);
+
return prjed_textrun;
}
public:
- static char *
+ static const char *
hilite(const char* text, int n, const char* pats);
static char *
brute_force(const char* text, int, const char* pats, int sensitive = 0);
- static char *
+ static const char *
project_textrun(const char *);
};