Mark global val_mgr as deprecated and fix uses of it to use namespaced version

This commit is contained in:
Tim Wojtulewicz 2020-07-02 13:08:41 -07:00
parent 3098dd6fbb
commit 86fdf0eaa9
134 changed files with 1579 additions and 1580 deletions

View file

@ -25,10 +25,10 @@ function levenshtein_distance%(s1: string, s2: string%): count
unsigned int m = s2->Len();
if ( ! n )
return val_mgr->Count(m);
return zeek::val_mgr->Count(m);
if ( ! m )
return val_mgr->Count(n);
return zeek::val_mgr->Count(n);
vector<vector<unsigned int> > d(n + 1, vector<unsigned int>(m + 1));
@ -47,7 +47,7 @@ function levenshtein_distance%(s1: string, s2: string%): count
d[i-1][j-1] + (s1->Bytes()[i-1] == s2->Bytes()[j-1] ? 0 : 1));
}
return val_mgr->Count(d[n][m]);
return zeek::val_mgr->Count(d[n][m]);
%}
## Concatenates all arguments into a single string. The function takes a
@ -286,7 +286,7 @@ zeek::Val* do_split(zeek::StringVal* str_val, RE_Matcher* re, int incl_sep, int
n=0;
}
auto ind = val_mgr->Count(++num);
auto ind = zeek::val_mgr->Count(++num);
a->Assign(std::move(ind), zeek::make_intrusive<zeek::StringVal>(offset, (const char*) s));
// No more separators will be needed if this is the end of string.
@ -295,7 +295,7 @@ zeek::Val* do_split(zeek::StringVal* str_val, RE_Matcher* re, int incl_sep, int
if ( incl_sep )
{ // including the part that matches the pattern
ind = val_mgr->Count(++num);
ind = zeek::val_mgr->Count(++num);
a->Assign(std::move(ind), zeek::make_intrusive<zeek::StringVal>(end_of_match, (const char*) s+offset));
}
@ -443,7 +443,7 @@ function gsub%(str: string, re: pattern, repl: string%): string
## *s1* is greater than, equal to, or less than *s2*.
function strcmp%(s1: string, s2: string%): int
%{
return val_mgr->Int(Bstr_cmp(s1->AsString(), s2->AsString()));
return zeek::val_mgr->Int(Bstr_cmp(s1->AsString(), s2->AsString()));
%}
## Locates the first occurrence of one string in another.
@ -458,7 +458,7 @@ function strcmp%(s1: string, s2: string%): int
## .. zeek:see:: find_all find_last
function strstr%(big: string, little: string%): count
%{
return val_mgr->Count(
return zeek::val_mgr->Count(
1 + big->AsString()->FindSubstring(little->AsString()));
%}
@ -626,9 +626,9 @@ function is_ascii%(str: string%): bool
for ( int i = 0; i < n; ++i )
if ( s[i] > 127 )
return val_mgr->False();
return zeek::val_mgr->False();
return val_mgr->True();
return zeek::val_mgr->True();
%}
## Replaces non-printable characters in a string with escaped sequences. The
@ -951,7 +951,7 @@ function find_last%(str: string, re: pattern%) : string
return zeek::make_intrusive<zeek::StringVal>(n, (const char*) t);
}
return val_mgr->EmptyString();
return zeek::val_mgr->EmptyString();
%}
## Returns a hex dump for given input data. The hex dump renders 16 bytes per
@ -996,13 +996,13 @@ function hexdump%(data_str: string%) : string
unsigned data_size = data_str->Len();
if ( ! data )
return val_mgr->EmptyString();
return zeek::val_mgr->EmptyString();
int num_lines = (data_size / 16) + 1;
int len = num_lines * HEX_LINE_WIDTH;
u_char* hex_data = new u_char[len + 1];
if ( ! hex_data )
return val_mgr->EmptyString();
return zeek::val_mgr->EmptyString();
memset(hex_data, ' ', len);