summaryrefslogtreecommitdiff
path: root/src/cstore
diff options
context:
space:
mode:
authorKim Hagen <kim.sidney@gmail.com>2017-11-01 13:29:33 +0100
committerKim Hagen <kim.sidney@gmail.com>2017-11-01 13:29:33 +0100
commit0b2db35f54fb38ac484854d22a8b2f9460c21689 (patch)
treed71486568bf897666a806afce603912733746eca /src/cstore
parent995fab7f6ba0530e05c5ea4dc4ac4aee86b3412a (diff)
downloadvyatta-cfg-0b2db35f54fb38ac484854d22a8b2f9460c21689.tar.gz
vyatta-cfg-0b2db35f54fb38ac484854d22a8b2f9460c21689.zip
replace deprecated auto_ptr for unique_ptr
Diffstat (limited to 'src/cstore')
-rw-r--r--src/cstore/cstore.cpp72
-rw-r--r--src/cstore/cstore.hpp2
-rw-r--r--src/cstore/unionfs/cstore-unionfs.cpp2
-rw-r--r--src/cstore/unionfs/cstore-unionfs.hpp4
4 files changed, 40 insertions, 40 deletions
diff --git a/src/cstore/cstore.cpp b/src/cstore/cstore.cpp
index 19fadad..d4921bd 100644
--- a/src/cstore/cstore.cpp
+++ b/src/cstore/cstore.cpp
@@ -215,7 +215,7 @@ void
Cstore::tmplGetChildNodes(const Cpath& path_comps,
vector<string>& cnodes)
{
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_tmpl_path(path_comps);
get_all_tmpl_child_node_names(cnodes);
sort_nodes(cnodes);
@@ -252,7 +252,7 @@ Cstore::deleteCfgPath(const Cpath& path_comps)
*/
if (def->getDefault()) {
// case 1. construct path for value file.
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(path_comps);
if (def->isValue()) {
// last comp is "value". need to go up 1 level.
@@ -287,7 +287,7 @@ Cstore::deleteCfgPath(const Cpath& path_comps)
* => remove node
*/
bool ret = false;
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(path_comps);
if (!def->isValue()) {
// sub-case (2)
@@ -333,7 +333,7 @@ Cstore::validateSetPath(const Cpath& path_comps)
return false;
}
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
if (!def->isValue()) {
if (!def->isTypeless()) {
/* disallow setting value node without value
@@ -383,7 +383,7 @@ Cstore::validateActivatePath(const Cpath& path_comps)
if (def->isTagValue() && def->getTagLimit() > 0) {
// we are activating a tag, and there is a limit on number of tags.
vector<string> cnodes;
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(path_comps);
string t;
pop_cfg_path(t);
@@ -452,7 +452,7 @@ Cstore::getEditEnv(const Cpath& path_comps, string& env)
return false;
}
}
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(path_comps);
append_tmpl_path(path_comps);
get_edit_env(env);
@@ -493,7 +493,7 @@ Cstore::getEditUpEnv(string& env)
output_user("%s\n", terr.c_str());
return false;
}
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
if (def->isTagValue()) {
// edit level is at "tag value". go up 1 extra level.
pop_cfg_path();
@@ -515,7 +515,7 @@ Cstore::getEditResetEnv(string& env)
{
ASSERT_IN_SESSION;
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
while (!edit_level_at_root()) {
pop_cfg_path();
pop_tmpl_path();
@@ -579,7 +579,7 @@ Cstore::getCompletionEnv(const Cpath& comps, string& env)
/* at this point, pcomps contains the command line arguments minus the
* "command" and the last one.
*/
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
bool is_typeless = true;
bool is_leaf_value = false;
bool is_value = false;
@@ -657,7 +657,7 @@ Cstore::getCompletionEnv(const Cpath& comps, string& env)
* so need to save current paths and reset them before (and restore them
* after).
*/
- auto_ptr<SavePaths> save1(create_save_paths());
+ unique_ptr<SavePaths> save1(create_save_paths());
reset_paths();
for (size_t i = 0; i < comp_vals.size(); i++) {
pair<string, string> hpair(comp_vals[i], "");
@@ -918,7 +918,7 @@ Cstore::validateMoveArgs(const Cpath& args)
output_user("Invalid move command\n");
return false;
}
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(epath);
append_tmpl_path(epath);
return validate_rename_copy(nargs, "move");
@@ -936,7 +936,7 @@ Cstore::renameCfgPath(const Cpath& args)
const char *otagnode = args[0];
const char *otagval = args[1];
const char *ntagval = args[4];
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
push_cfg_path(otagnode);
if (!rename_child_node(otagval, ntagval)) {
return false;
@@ -1038,7 +1038,7 @@ Cstore::commentCfgPath(const Cpath& args)
bool ret = false;
{
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(path_comps);
if (comment == "") {
// follow original impl: empty comment => remove it
@@ -1096,7 +1096,7 @@ Cstore::moveCfgPath(const Cpath& args)
output_user("Invalid move command\n");
return false;
}
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(epath);
append_tmpl_path(epath);
return renameCfgPath(nargs);
@@ -1178,7 +1178,7 @@ Cstore::cfgPathChanged(const Cpath& path_comps)
if (cfgPathDeleted(path_comps) || cfgPathAdded(path_comps)) {
return true;
}
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(path_comps);
return cfg_node_changed();
}
@@ -1296,7 +1296,7 @@ Cstore::cfgPathMarkedDeactivated(const Cpath& path_comps, bool active_cfg)
ASSERT_IN_SESSION;
}
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(path_comps);
return marked_deactivated(active_cfg);
}
@@ -1331,7 +1331,7 @@ Cstore::cfgPathGetChildNodesDA(const Cpath& path_comps, vector<string>& cnodes,
return;
}
{
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(path_comps);
get_all_child_node_names(cnodes, active_cfg, include_deactivated);
}
@@ -1384,7 +1384,7 @@ Cstore::cfgPathGetValueDA(const Cpath& path_comps, string& value,
return false;
}
vector<string> vvec;
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(path_comps);
if (read_value_vec(vvec, active_cfg)) {
if (vvec.size() >= 1) {
@@ -1441,7 +1441,7 @@ Cstore::cfgPathGetValuesDA(const Cpath& path_comps, vector<string>& values,
// specified node doesn't exist
return false;
}
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(path_comps);
return read_value_vec(values, active_cfg);
}
@@ -1460,7 +1460,7 @@ Cstore::cfgPathGetComment(const Cpath& path_comps, string& comment,
ASSERT_IN_SESSION;
}
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(path_comps);
return get_comment(comment, active_cfg);
}
@@ -1476,7 +1476,7 @@ Cstore::cfgPathDefault(const Cpath& path_comps, bool active_cfg)
ASSERT_IN_SESSION;
}
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(path_comps);
return marked_display_default(active_cfg);
}
@@ -1716,7 +1716,7 @@ Cstore::cfgPathGetEffectiveValues(const Cpath& path_comps,
char *
Cstore::getVarRef(const char *ref_str, vtw_type_e& type, bool from_active)
{
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
VarRef vref(this, ref_str, from_active);
string val;
vtw_type_e t;
@@ -1752,7 +1752,7 @@ Cstore::setVarRef(const char *ref_str, const char *value, bool to_active)
* that's what the template specifies.
* * it only supports only single-value leaf nodes.
*/
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
VarRef vref(this, ref_str, to_active);
Cpath pcomps;
if (vref.getSetPath(pcomps)) {
@@ -1786,7 +1786,7 @@ Cstore::markCfgPathDeactivated(const Cpath& path_comps)
return true;
}
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(path_comps);
// note: also mark changed
return (mark_deactivated() && unmark_deactivated_descendants()
@@ -1802,7 +1802,7 @@ Cstore::unmarkCfgPathDeactivated(const Cpath& path_comps)
{
ASSERT_IN_SESSION;
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(path_comps);
// note: also mark changed
return (unmark_deactivated() && mark_changed_with_ancestors());
@@ -1919,7 +1919,7 @@ Cstore::unmarkCfgPathChanged(const Cpath& path_comps)
{
ASSERT_IN_SESSION;
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(path_comps);
return unmark_changed_with_descendants();
}
@@ -1935,7 +1935,7 @@ Cstore::executeTmplActions(char *at_str, const Cpath& path,
sdisp += " ";
set_at_string(at_str);
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(path);
append_tmpl_path(path);
@@ -1950,7 +1950,7 @@ Cstore::executeTmplActions(char *at_str, const Cpath& path,
bool
Cstore::cfgPathMarkedCommitted(const Cpath& path_comps, bool is_delete)
{
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(path_comps);
return marked_committed(is_delete);
}
@@ -1958,7 +1958,7 @@ Cstore::cfgPathMarkedCommitted(const Cpath& path_comps, bool is_delete)
bool
Cstore::markCfgPathCommitted(const Cpath& path_comps, bool is_delete)
{
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(path_comps);
return mark_committed(is_delete);
}
@@ -2105,7 +2105,7 @@ Cstore::get_parsed_tmpl(const Cpath& path_comps, bool validate_vals,
}
}
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
/* need at least 1 comp to work. 2 comps if last comp is value.
* so pop tmpl_path and prepend them. note that path_comps remain
@@ -2375,7 +2375,7 @@ Cstore::cfg_path_exists(const Cpath& path_comps, bool active_cfg,
{
bool ret = false;
{
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(path_comps);
// first check if it's a "node".
ret = cfg_node_exists(active_cfg);
@@ -2427,7 +2427,7 @@ Cstore::set_cfg_path(const Cpath& path_comps, bool output)
}
// paths have not been changed up to this point. now save them.
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
path_exists = false;
@@ -2479,7 +2479,7 @@ Cstore::set_cfg_path(const Cpath& path_comps, bool output)
}
if (ret && def->isValue() && def->getDefault()) {
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
/* a node with default has been explicitly set. needs to be marked
* as non-default for display purposes.
*
@@ -2630,7 +2630,7 @@ Cstore::get_child_nodes_status_da(const Cpath& path_comps,
&& cfg_path_exists(ppath, false, true)) {
cmap[work_nodes[i]] = C_NODE_STATUS_ADDED;
} else {
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
append_cfg_path(ppath);
if (cfg_node_changed()) {
cmap[work_nodes[i]] = C_NODE_STATUS_CHANGED;
@@ -2739,7 +2739,7 @@ Cstore::validate_val(const tr1::shared_ptr<Ctemplate>& def, const char *value)
}
// validate_value() may change "value". make a copy first.
- auto_ptr<char> vbuf(strdup(value));
+ unique_ptr<char> vbuf(strdup(value));
/* set the handle to be used during validate_value() for var ref
* processing. this is a global var in cli_new.c.
@@ -2861,7 +2861,7 @@ Cstore::create_default_children(const Cpath& path_comps)
bool ret = true;
Cpath pcomps(path_comps);
// need to save/reset/restore paths for get_parsed_tmpl()
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
reset_paths();
for (size_t i = 0; i < tcnodes.size(); i++) {
pcomps.push(tcnodes[i]);
diff --git a/src/cstore/cstore.hpp b/src/cstore/cstore.hpp
index 741d9f1..3777152 100644
--- a/src/cstore/cstore.hpp
+++ b/src/cstore/cstore.hpp
@@ -340,7 +340,7 @@ private:
virtual void pop_cfg_path(string& last) = 0;
virtual void append_cfg_path(const Cpath& path_comps) = 0;
virtual void reset_paths(bool to_root = false) = 0;
- virtual auto_ptr<SavePaths> create_save_paths() = 0;
+ virtual unique_ptr<SavePaths> create_save_paths() = 0;
virtual bool cfg_path_at_root() = 0;
virtual bool tmpl_path_at_root() = 0;
// end path modifiers
diff --git a/src/cstore/unionfs/cstore-unionfs.cpp b/src/cstore/unionfs/cstore-unionfs.cpp
index 2f0042a..d061967 100644
--- a/src/cstore/unionfs/cstore-unionfs.cpp
+++ b/src/cstore/unionfs/cstore-unionfs.cpp
@@ -560,7 +560,7 @@ UnionfsCstore::clearCommittedMarkers()
bool
UnionfsCstore::construct_commit_active(commit::PrioNode& node)
{
- auto_ptr<SavePaths> save(create_save_paths());
+ unique_ptr<SavePaths> save(create_save_paths());
reset_paths();
append_cfg_path(node.getCommitPath());
diff --git a/src/cstore/unionfs/cstore-unionfs.hpp b/src/cstore/unionfs/cstore-unionfs.hpp
index 1196ae9..fd145ad 100644
--- a/src/cstore/unionfs/cstore-unionfs.hpp
+++ b/src/cstore/unionfs/cstore-unionfs.hpp
@@ -186,8 +186,8 @@ private:
FsPath cpath;
FsPath tpath;
};
- auto_ptr<SavePaths> create_save_paths() {
- return auto_ptr<SavePaths>(new UnionfsSavePaths(this));
+ unique_ptr<SavePaths> create_save_paths() {
+ return unique_ptr<SavePaths>(new UnionfsSavePaths(this));
};
bool cfg_path_at_root() {