mirror of
https://github.com/zeek/zeek.git
synced 2025-10-15 04:58:21 +00:00
bifcl: Add clang-format and run it on everything
This commit is contained in:
parent
552be424c4
commit
3a18b2144c
3 changed files with 30 additions and 33 deletions
|
@ -1,10 +1,11 @@
|
|||
//
|
||||
// See the file "COPYING" in the main distribution directory for copyright.
|
||||
|
||||
#include <string>
|
||||
#include <string.h>
|
||||
#include "module_util.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
static int streq(const char* s1, const char* s2)
|
||||
{
|
||||
return ! strcmp(s1, s2);
|
||||
|
@ -24,7 +25,7 @@ string extract_module_name(const char* name)
|
|||
return module_name;
|
||||
}
|
||||
|
||||
string extract_var_name(const char *name)
|
||||
string extract_var_name(const char* name)
|
||||
{
|
||||
string var_name = name;
|
||||
string::size_type pos = var_name.rfind("::");
|
||||
|
@ -35,14 +36,13 @@ string extract_var_name(const char *name)
|
|||
if ( pos + 2 > var_name.size() )
|
||||
return string("");
|
||||
|
||||
return var_name.substr(pos+2);
|
||||
return var_name.substr(pos + 2);
|
||||
}
|
||||
|
||||
string normalized_module_name(const char* module_name)
|
||||
{
|
||||
int mod_len;
|
||||
if ( (mod_len = strlen(module_name)) >= 2 &&
|
||||
streq(module_name + mod_len - 2, "::") )
|
||||
if ( (mod_len = strlen(module_name)) >= 2 && streq(module_name + mod_len - 2, "::") )
|
||||
mod_len -= 2;
|
||||
|
||||
return string(module_name, mod_len);
|
||||
|
@ -50,8 +50,7 @@ string normalized_module_name(const char* module_name)
|
|||
|
||||
string make_full_var_name(const char* module_name, const char* var_name)
|
||||
{
|
||||
if ( ! module_name || streq(module_name, GLOBAL_MODULE_NAME) ||
|
||||
strstr(var_name, "::") )
|
||||
if ( ! module_name || streq(module_name, GLOBAL_MODULE_NAME) || strstr(var_name, "::") )
|
||||
{
|
||||
if ( streq(GLOBAL_MODULE_NAME, extract_module_name(var_name).c_str()) )
|
||||
return extract_var_name(var_name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue