mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Deprecate opt_internal_val()
This commit is contained in:
parent
26f6fe01c8
commit
447b052d11
5 changed files with 23 additions and 7 deletions
20
src/Var.cc
20
src/Var.cc
|
@ -693,31 +693,41 @@ Val* opt_internal_val(const char* name)
|
|||
|
||||
double opt_internal_double(const char* name)
|
||||
{
|
||||
Val* v = opt_internal_val(name);
|
||||
auto id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id ) return 0.0;
|
||||
const auto& v = id->GetVal();
|
||||
return v ? v->InternalDouble() : 0.0;
|
||||
}
|
||||
|
||||
bro_int_t opt_internal_int(const char* name)
|
||||
{
|
||||
Val* v = opt_internal_val(name);
|
||||
auto id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id ) return 0;
|
||||
const auto& v = id->GetVal();
|
||||
return v ? v->InternalInt() : 0;
|
||||
}
|
||||
|
||||
bro_uint_t opt_internal_unsigned(const char* name)
|
||||
{
|
||||
Val* v = opt_internal_val(name);
|
||||
auto id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id ) return 0;
|
||||
const auto& v = id->GetVal();
|
||||
return v ? v->InternalUnsigned() : 0;
|
||||
}
|
||||
|
||||
StringVal* opt_internal_string(const char* name)
|
||||
{
|
||||
Val* v = opt_internal_val(name);
|
||||
auto id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id ) return nullptr;
|
||||
const auto& v = id->GetVal();
|
||||
return v ? v->AsStringVal() : nullptr;
|
||||
}
|
||||
|
||||
TableVal* opt_internal_table(const char* name)
|
||||
{
|
||||
Val* v = opt_internal_val(name);
|
||||
auto id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id ) return nullptr;
|
||||
const auto& v = id->GetVal();
|
||||
return v ? v->AsTableVal() : nullptr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue