DtSrHitword* kwics = NULL;
long n_kwics = 0;
- char* parseout = NULL;
+ const char* parseout = NULL;
// hack! overwrite f_language, since austext's value is wrong
// In future, the next lines should be removed.
#define True 1
#endif
-char *
+const char *
StringParser::brute_force(const char* text_in, int n_of_pats,
const char* patterns, int sensitive)
{
if (caped_text)
delete[] caped_text;
- string trunstr = text_run.str();
- char* ret_text = (char *)trunstr.c_str();
+ static string trunstr = text_run.str();
- if (ret_text == NULL)
- return NULL;
- else if (*ret_text == '\0') {
- delete[] ret_text;
- return NULL;
- }
- else
- return ret_text;
+ if (!trunstr.size())
+ return NULL;
+ return trunstr.c_str();
}
const char *
const char *
StringParser::hilite(const char* text, int n, const char* pats)
{
- char* textrun = brute_force(text, n, pats);
+ const char* textrun = brute_force(text, n, pats);
if (textrun == NULL)
return NULL;
- delete[] textrun;
-
- const char* prjed_textrun = project_textrun(textrun);
-
- return prjed_textrun;
+ return project_textrun(textrun);
}
static const char *
hilite(const char* text, int n, const char* pats);
- static char *
+ static const char *
brute_force(const char* text, int, const char* pats, int sensitive = 0);
static const char *