mirror of
https://github.com/zeek/zeek.git
synced 2025-10-01 22:28:20 +00:00
bifcl: Some other minor cleanup
This commit is contained in:
parent
23a5e46b8e
commit
867d91b535
4 changed files with 8 additions and 8 deletions
|
@ -37,7 +37,7 @@ string type_name;
|
|||
// already been defined/written to the C++ files.
|
||||
static std::set<std::string> events;
|
||||
|
||||
enum {
|
||||
enum : uint8_t {
|
||||
C_SEGMENT_DEF,
|
||||
FUNC_DEF,
|
||||
EVENT_DEF,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
|
||||
enum builtin_func_arg_type {
|
||||
enum builtin_func_arg_type : uint8_t {
|
||||
#define DEFINE_BIF_TYPE(id, bif_type, bro_type, c_type, c_type_smart, accessor, accessor_smart, cast_smart, \
|
||||
constructor, ctor_smart) \
|
||||
id,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
static const char* GLOBAL_MODULE_NAME = "GLOBAL";
|
||||
static constexpr const char* GLOBAL_MODULE_NAME = "GLOBAL";
|
||||
|
||||
extern std::string extract_module_name(const char* name);
|
||||
extern std::string extract_var_name(const char* name);
|
||||
|
|
|
@ -16,7 +16,7 @@ string extract_module_name(const char* name) {
|
|||
string::size_type pos = module_name.rfind("::");
|
||||
|
||||
if ( pos == string::npos )
|
||||
return string(GLOBAL_MODULE_NAME);
|
||||
return GLOBAL_MODULE_NAME;
|
||||
|
||||
module_name.erase(pos);
|
||||
|
||||
|
@ -31,17 +31,17 @@ string extract_var_name(const char* name) {
|
|||
return var_name;
|
||||
|
||||
if ( pos + 2 > var_name.size() )
|
||||
return string("");
|
||||
return "";
|
||||
|
||||
return var_name.substr(pos + 2);
|
||||
}
|
||||
|
||||
string normalized_module_name(const char* module_name) {
|
||||
int mod_len;
|
||||
size_t mod_len;
|
||||
if ( mod_len = strlen(module_name); mod_len >= 2 && streq(module_name + mod_len - 2, "::") )
|
||||
mod_len -= 2;
|
||||
|
||||
return string(module_name, mod_len);
|
||||
return {module_name, mod_len};
|
||||
}
|
||||
|
||||
string make_full_var_name(const char* module_name, const char* var_name) {
|
||||
|
@ -49,7 +49,7 @@ string make_full_var_name(const char* module_name, const char* var_name) {
|
|||
if ( streq(GLOBAL_MODULE_NAME, extract_module_name(var_name).c_str()) )
|
||||
return extract_var_name(var_name);
|
||||
|
||||
return string(var_name);
|
||||
return var_name;
|
||||
}
|
||||
|
||||
string full_name = normalized_module_name(module_name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue