mirror of
https://github.com/zeek/zeek.git
synced 2025-10-15 13:08:20 +00:00
Change lookup_ID() to return a const-reference
This commit is contained in:
parent
8f95a2a0bb
commit
0af7f8141b
9 changed files with 32 additions and 28 deletions
14
src/Var.cc
14
src/Var.cc
|
@ -688,13 +688,13 @@ Val* internal_const_val(const char* name)
|
|||
|
||||
Val* opt_internal_val(const char* name)
|
||||
{
|
||||
auto id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
const auto& id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
return id ? id->GetVal().get() : nullptr;
|
||||
}
|
||||
|
||||
double opt_internal_double(const char* name)
|
||||
{
|
||||
auto id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
const auto& id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id ) return 0.0;
|
||||
const auto& v = id->GetVal();
|
||||
return v ? v->InternalDouble() : 0.0;
|
||||
|
@ -702,7 +702,7 @@ double opt_internal_double(const char* name)
|
|||
|
||||
bro_int_t opt_internal_int(const char* name)
|
||||
{
|
||||
auto id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
const auto& id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id ) return 0;
|
||||
const auto& v = id->GetVal();
|
||||
return v ? v->InternalInt() : 0;
|
||||
|
@ -710,7 +710,7 @@ bro_int_t opt_internal_int(const char* name)
|
|||
|
||||
bro_uint_t opt_internal_unsigned(const char* name)
|
||||
{
|
||||
auto id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
const auto& id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id ) return 0;
|
||||
const auto& v = id->GetVal();
|
||||
return v ? v->InternalUnsigned() : 0;
|
||||
|
@ -718,7 +718,7 @@ bro_uint_t opt_internal_unsigned(const char* name)
|
|||
|
||||
StringVal* opt_internal_string(const char* name)
|
||||
{
|
||||
auto id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
const auto& id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id ) return nullptr;
|
||||
const auto& v = id->GetVal();
|
||||
return v ? v->AsStringVal() : nullptr;
|
||||
|
@ -726,7 +726,7 @@ StringVal* opt_internal_string(const char* name)
|
|||
|
||||
TableVal* opt_internal_table(const char* name)
|
||||
{
|
||||
auto id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
const auto& id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id ) return nullptr;
|
||||
const auto& v = id->GetVal();
|
||||
return v ? v->AsTableVal() : nullptr;
|
||||
|
@ -734,7 +734,7 @@ TableVal* opt_internal_table(const char* name)
|
|||
|
||||
ListVal* internal_list_val(const char* name)
|
||||
{
|
||||
auto id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
const auto& id = lookup_ID(name, GLOBAL_MODULE_NAME);
|
||||
if ( ! id )
|
||||
return nullptr;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue