mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 00:58:19 +00:00
Merge branch 'master' of https://github.com/ZekeMedley/zeek
* 'master' of https://github.com/ZekeMedley/zeek: Use the right delete and improve the leak test. Increases the size of the table being loaded in the pattern leak test and uses the right delete method. Fix formatting. Fix memory leak and add test. Add pattern support to input framework.
This commit is contained in:
commit
59596e0bfa
9 changed files with 213 additions and 3 deletions
|
@ -325,6 +325,29 @@ threading::Value* Ascii::ParseValue(const string& s, const string& name, TypeTag
|
|||
break;
|
||||
}
|
||||
|
||||
case TYPE_PATTERN:
|
||||
{
|
||||
string candidate = get_unescaped_string(s);
|
||||
// A string is a candidate pattern iff it begins and ends with
|
||||
// a '/'. Rather or not the rest of the string is legal will
|
||||
// be determined later when it is given to the RE engine.
|
||||
if ( candidate.size() >= 2 )
|
||||
{
|
||||
if ( candidate.front() == candidate.back() &&
|
||||
candidate.back() == '/' )
|
||||
{
|
||||
// Remove the '/'s
|
||||
candidate.erase(0, 1);
|
||||
candidate.erase(candidate.size() - 1);
|
||||
val->val.pattern_text_val = copy_string(candidate.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GetThread()->Error(GetThread()->Fmt("String '%s' contained no parseable pattern.", candidate.c_str()));
|
||||
goto parse_error;
|
||||
}
|
||||
|
||||
case TYPE_TABLE:
|
||||
case TYPE_VECTOR:
|
||||
// First - common initialization
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue