summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--perl_dmod/Cstore/Cstore.xs2
-rw-r--r--src/cli_bin.cpp2
-rw-r--r--src/cli_shell_api.cpp2
-rw-r--r--src/cnode/cnode-algorithm.cpp1
-rw-r--r--src/cnode/cnode.cpp2
-rw-r--r--src/cnode/cnode.hpp2
-rw-r--r--src/cparse/cparse.hpp6
-rw-r--r--src/cparse/cparse.ypp17
-rw-r--r--src/cstore/cstore-c.cpp2
-rw-r--r--src/cstore/cstore-varref.cpp2
-rw-r--r--src/cstore/cstore-varref.hpp4
-rw-r--r--src/cstore/cstore.cpp1
-rw-r--r--src/cstore/cstore.hpp4
-rw-r--r--src/cstore/unionfs/cstore-unionfs.cpp1
-rw-r--r--src/cstore/unionfs/cstore-unionfs.hpp4
15 files changed, 37 insertions, 15 deletions
diff --git a/perl_dmod/Cstore/Cstore.xs b/perl_dmod/Cstore/Cstore.xs
index 988f575..730a936 100644
--- a/perl_dmod/Cstore/Cstore.xs
+++ b/perl_dmod/Cstore/Cstore.xs
@@ -28,6 +28,8 @@
#include <cstore/cstore.hpp>
+using namespace cstore;
+
typedef SV STRVEC;
typedef SV STRSTRMAP;
diff --git a/src/cli_bin.cpp b/src/cli_bin.cpp
index e8ff95a..11c63a1 100644
--- a/src/cli_bin.cpp
+++ b/src/cli_bin.cpp
@@ -24,6 +24,8 @@
#include <cli_cstore.h>
#include <cstore/cstore.hpp>
+using namespace cstore;
+
static int op_idx = -1;
static const char *op_bin_name[] = {
"my_set",
diff --git a/src/cli_shell_api.cpp b/src/cli_shell_api.cpp
index 0c76daa..41d18e2 100644
--- a/src/cli_shell_api.cpp
+++ b/src/cli_shell_api.cpp
@@ -27,6 +27,8 @@
#include <cnode/cnode-algorithm.hpp>
#include <cparse/cparse.hpp>
+using namespace cstore;
+
/* This program provides an API for shell scripts (e.g., snippets in
* templates, standalone scripts, etc.) to access the CLI cstore library.
* It is installed in "/opt/vyatta/sbin", but a symlink "/bin/cli-shell-api"
diff --git a/src/cnode/cnode-algorithm.cpp b/src/cnode/cnode-algorithm.cpp
index 3722d13..9ac5404 100644
--- a/src/cnode/cnode-algorithm.cpp
+++ b/src/cnode/cnode-algorithm.cpp
@@ -24,7 +24,6 @@
#include <cparse/cparse.hpp>
#include <cnode/cnode-algorithm.hpp>
-using namespace std;
using namespace cnode;
diff --git a/src/cnode/cnode.cpp b/src/cnode/cnode.cpp
index 142ed9f..c88a495 100644
--- a/src/cnode/cnode.cpp
+++ b/src/cnode/cnode.cpp
@@ -23,9 +23,9 @@
#include <cli_cstore.h>
#include <cnode/cnode.hpp>
-using namespace std;
using namespace cnode;
+
////// constructors/destructors
CfgNode::CfgNode(vector<string>& path_comps, char *name, char *val,
char *comment, int deact, Cstore *cstore,
diff --git a/src/cnode/cnode.hpp b/src/cnode/cnode.hpp
index dadfe85..b7afc36 100644
--- a/src/cnode/cnode.hpp
+++ b/src/cnode/cnode.hpp
@@ -23,6 +23,8 @@
namespace cnode {
+using namespace cstore;
+
class CfgNode {
public:
CfgNode(vector<string>& path_comps, char *name, char *val, char *comment,
diff --git a/src/cparse/cparse.hpp b/src/cparse/cparse.hpp
index d359deb..c80562a 100644
--- a/src/cparse/cparse.hpp
+++ b/src/cparse/cparse.hpp
@@ -22,8 +22,10 @@
namespace cparse {
-cnode::CfgNode *parse_file(FILE *fin, Cstore& cs);
-cnode::CfgNode *parse_file(const char *fname, Cstore& cs);
+using namespace cnode;
+
+CfgNode *parse_file(FILE *fin, Cstore& cs);
+CfgNode *parse_file(const char *fname, Cstore& cs);
} // namespace cparse
diff --git a/src/cparse/cparse.ypp b/src/cparse/cparse.ypp
index 535ec3d..6ce60d0 100644
--- a/src/cparse/cparse.ypp
+++ b/src/cparse/cparse.ypp
@@ -9,6 +9,8 @@
#include "cparse.hpp"
#include "cparse_def.h"
+using namespace cparse;
+
/* to enable tracing, define ENABLE_PARSER_TRACE. may also want to invoke
* bison with "-v" (by changing Makefile.am).
*/
@@ -17,9 +19,6 @@
#define YYDEBUG 1
#endif // ENABLE_PARSER_TRACE
-using namespace std;
-using namespace cnode;
-
// stuff from lex
extern "C" {
extern int cparse_lineno;
@@ -42,7 +41,7 @@ static char *nval = NULL;
// XXX optimize: use unordered_map with non-vector
static map<vector<string>, CfgNode *> node_map;
-static Cstore *cstore = NULL;
+static Cstore *cstore_ = NULL;
static CfgNode *cur_node = NULL;
static CfgNode *cur_parent = NULL;
static vector<CfgNode *> cur_path;
@@ -66,7 +65,7 @@ add_node()
cur_node = onode;
} else if (onode->isTag()) {
// a new value for a "tag node"
- cur_node = new CfgNode(pcomps, nname, nval, ncomment, ndeact, cstore);
+ cur_node = new CfgNode(pcomps, nname, nval, ncomment, ndeact, cstore_);
onode->addChildNode(cur_node);
} else {
/* a new value for a single-value node => invalid?
@@ -81,12 +80,12 @@ add_node()
}
} else {
// new node
- cur_node = new CfgNode(pcomps, nname, nval, ncomment, ndeact, cstore);
+ cur_node = new CfgNode(pcomps, nname, nval, ncomment, ndeact, cstore_);
CfgNode *mapped_node = cur_node;
if (cur_node->isTag() && cur_node->isValue()) {
// tag value => need to add the "tag node" on top
// (need to force "tag" if the node is invalid => tag_if_invalid)
- CfgNode *p = new CfgNode(pcomps, nname, NULL, NULL, ndeact, cstore,
+ CfgNode *p = new CfgNode(pcomps, nname, NULL, NULL, ndeact, cstore_,
true);
p->addChildNode(cur_node);
mapped_node = p;
@@ -192,7 +191,7 @@ cparse::parse_file(FILE *fin, Cstore& cs)
// initial state
cparse_set_in(fin);
- cstore = &cs;
+ cstore_ = &cs;
ndeact = 0;
ncomment = NULL;
nname = NULL;
@@ -202,7 +201,7 @@ cparse::parse_file(FILE *fin, Cstore& cs)
pcomp_is_value.clear();
cur_path.clear();
cur_node = NULL;
- cur_parent = new CfgNode(pcomps, nname, nval, ncomment, ndeact, cstore);
+ cur_parent = new CfgNode(pcomps, nname, nval, ncomment, ndeact, cstore_);
if (cparse_parse() != 0) {
// parsing failed
diff --git a/src/cstore/cstore-c.cpp b/src/cstore/cstore-c.cpp
index 292ff38..50828c4 100644
--- a/src/cstore/cstore-c.cpp
+++ b/src/cstore/cstore-c.cpp
@@ -22,6 +22,8 @@
#include <cstore/cstore.hpp>
#include <cstore/cstore-c.h>
+using namespace cstore;
+
static void
_get_str_vec(vector<string>& vec, const char *strs[], int num_strs)
{
diff --git a/src/cstore/cstore-varref.cpp b/src/cstore/cstore-varref.cpp
index ac80ba2..79ab56f 100644
--- a/src/cstore/cstore-varref.cpp
+++ b/src/cstore/cstore-varref.cpp
@@ -22,7 +22,7 @@
#include <cli_cstore.h>
#include <cstore/cstore-varref.hpp>
-using namespace std;
+using namespace cstore;
////// constructors/destructors
Cstore::VarRef::VarRef(Cstore *cstore, const string& ref_str, bool active)
diff --git a/src/cstore/cstore-varref.hpp b/src/cstore/cstore-varref.hpp
index 7ab523f..3b842a9 100644
--- a/src/cstore/cstore-varref.hpp
+++ b/src/cstore/cstore-varref.hpp
@@ -22,7 +22,7 @@
#include <cstore/cstore.hpp>
-using namespace std;
+namespace cstore { // begin namespace cstore
class Cstore::VarRef {
public:
@@ -44,5 +44,7 @@ private:
const vector<string>& cur_path_comps, vtw_type_e def_type);
};
+} // end namespace cstore
+
#endif /* _CSTORE_VARREF_H_ */
diff --git a/src/cstore/cstore.cpp b/src/cstore/cstore.cpp
index b6b55be..39c57cd 100644
--- a/src/cstore/cstore.cpp
+++ b/src/cstore/cstore.cpp
@@ -36,6 +36,7 @@
#include <cnode/cnode-algorithm.hpp>
#include <cparse/cparse.hpp>
+using namespace cstore;
////// constants
//// node status
diff --git a/src/cstore/cstore.hpp b/src/cstore/cstore.hpp
index 9a41279..c76cb8f 100644
--- a/src/cstore/cstore.hpp
+++ b/src/cstore/cstore.hpp
@@ -45,6 +45,8 @@ extern "C" void* Perl_get_context(void)
#define SAVE_PATHS save_paths(&__func__)
#define RESTORE_PATHS restore_paths(&__func__)
+namespace cstore { // begin namespace cstore
+
using namespace std;
class Cstore {
@@ -495,5 +497,7 @@ private:
static void vexit_internal(const char *fmt, va_list alist);
};
+} // end namespace cstore
+
#endif /* _CSTORE_H_ */
diff --git a/src/cstore/unionfs/cstore-unionfs.cpp b/src/cstore/unionfs/cstore-unionfs.cpp
index 233a111..59b5582 100644
--- a/src/cstore/unionfs/cstore-unionfs.cpp
+++ b/src/cstore/unionfs/cstore-unionfs.cpp
@@ -26,6 +26,7 @@
#include <cli_cstore.h>
#include <cstore/unionfs/cstore-unionfs.hpp>
+using namespace cstore;
////// constants
// environment vars defining root dirs
diff --git a/src/cstore/unionfs/cstore-unionfs.hpp b/src/cstore/unionfs/cstore-unionfs.hpp
index 70d4cf6..29f6822 100644
--- a/src/cstore/unionfs/cstore-unionfs.hpp
+++ b/src/cstore/unionfs/cstore-unionfs.hpp
@@ -29,6 +29,8 @@
#include <cli_cstore.h>
#include <cstore/cstore.hpp>
+namespace cstore { // begin namespace cstore
+
namespace b_fs = boost::filesystem;
class UnionfsCstore : public Cstore {
@@ -231,5 +233,7 @@ private:
};
};
+} // end namespace cstore
+
#endif /* _CSTORE_UNIONFS_H_ */