bifcl: Don't do 'using namespace std' in headers, plus a little cleanup

This commit is contained in:
Tim Wojtulewicz 2025-05-09 15:01:03 -07:00
parent 75a8814cee
commit c30aa7a903
2 changed files with 8 additions and 8 deletions

View file

@ -6,14 +6,12 @@
#include <string>
using namespace std;
static const char* GLOBAL_MODULE_NAME = "GLOBAL";
extern string extract_module_name(const char* name);
extern string extract_var_name(const char* name);
extern string normalized_module_name(const char* module_name); // w/o ::
extern std::string extract_module_name(const char* name);
extern std::string extract_var_name(const char* name);
extern std::string normalized_module_name(const char* module_name); // w/o ::
// Concatenates module_name::var_name unless var_name is already fully
// qualified, in which case it is returned unmodified.
extern string make_full_var_name(const char* module_name, const char* var_name);
extern std::string make_full_var_name(const char* module_name, const char* var_name);

View file

@ -3,9 +3,11 @@
#include "module_util.h"
#include <string.h>
#include <cstring>
#include <string>
using namespace std;
static int streq(const char* s1, const char* s2) { return ! strcmp(s1, s2); }
// Returns it without trailing "::".
@ -36,7 +38,7 @@ string extract_var_name(const char* name) {
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); mod_len >= 2 && streq(module_name + mod_len - 2, "::") )
mod_len -= 2;
return string(module_name, mod_len);