Commit e6e1366f authored by Jelte Jansen's avatar Jelte Jansen

Applied patch that came out of the review ticket http://bind10.isc.org/ticket/20

(noting that we probably might want to think about catching bad_alloc somewhere, but more on the event level, not here, and doing that right requires some careful checking of other code too)


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@1869 e5f2f494-b856-4b98-b285-d166d9295462
parent c150ac07
......@@ -204,47 +204,27 @@ bool operator==(const isc::data::ElementPtr a, const isc::data::ElementPtr b) {
//
ElementPtr
Element::create(const int i) {
try {
return ElementPtr(new IntElement(i));
} catch (std::bad_alloc) {
return ElementPtr();
}
return ElementPtr(new IntElement(i));
}
ElementPtr
Element::create(const double d) {
try {
return ElementPtr(new DoubleElement(d));
} catch (std::bad_alloc) {
return ElementPtr();
}
return ElementPtr(new DoubleElement(d));
}
ElementPtr
Element::create(const std::string& s) {
try {
return ElementPtr(new StringElement(s));
} catch (std::bad_alloc) {
return ElementPtr();
}
return ElementPtr(new StringElement(s));
}
ElementPtr
Element::create(const bool b) {
try {
return ElementPtr(new BoolElement(b));
} catch (std::bad_alloc) {
return ElementPtr();
}
return ElementPtr(new BoolElement(b));
}
ElementPtr
Element::create(const std::vector<ElementPtr>& v) {
try {
return ElementPtr(new ListElement(v));
} catch (std::bad_alloc) {
return ElementPtr();
}
return ElementPtr(new ListElement(v));
}
ElementPtr
......@@ -255,11 +235,7 @@ Element::create(const std::map<std::string, ElementPtr>& m) {
isc_throw(TypeError, "Map tag is too long");
}
}
try {
return ElementPtr(new MapElement(m));
} catch (std::bad_alloc) {
return ElementPtr();
}
return ElementPtr(new MapElement(m));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment