summaryrefslogtreecommitdiffstats
path: root/src/utl_yaml.cpp
diff options
context:
space:
mode:
authorDan Klein <danklei@cisco.com>2015-10-22 05:31:22 +0300
committerDan Klein <danklei@cisco.com>2015-10-22 05:31:22 +0300
commitf5c4a8051d697c086eb0d1c8ce3ac90ab245d249 (patch)
treefb0d379947c4b1984b77f6594d27f96d72c3cba0 /src/utl_yaml.cpp
parent508703e11a3fad3e44535c5433f803d77f28e245 (diff)
parent876c76572fdb2fb8f0e8db21bc420d284dc05950 (diff)
Merge branch 'master' into dan_stateless
Diffstat (limited to 'src/utl_yaml.cpp')
-rwxr-xr-xsrc/utl_yaml.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/utl_yaml.cpp b/src/utl_yaml.cpp
index 237e85af..5f3ca735 100755
--- a/src/utl_yaml.cpp
+++ b/src/utl_yaml.cpp
@@ -70,13 +70,15 @@ bool utl_yaml_read_ip_addr(const YAML::Node& node,
std::string tmp;
uint32_t ip;
bool res=false;
- try {
+ if ( node.FindValue(name) ) {
node[name] >> tmp ;
if ( my_inet_pton4((char *)tmp.c_str(), (unsigned char *)&ip) ){
val=PKT_NTOHL(ip);
res=true;
+ }else{
+ printf(" ERROR not a valid ip %s \n",(char *)tmp.c_str());
+ exit(-1);
}
- }catch ( const std::exception& e ) {
}
return (res);
}
@@ -85,14 +87,11 @@ bool utl_yaml_read_uint32(const YAML::Node& node,
std::string name,
uint32_t & val){
bool res=false;
-
- try {
+ if ( node.FindValue(name) ) {
node[name] >> val ;
res=true;
- }catch ( const std::exception& e ) {
}
return (res);
-
}
bool utl_yaml_read_uint16(const YAML::Node& node,
@@ -100,12 +99,10 @@ bool utl_yaml_read_uint16(const YAML::Node& node,
uint16_t & val){
uint32_t val_tmp;
bool res=false;
-
- try {
+ if ( node.FindValue(name) ) {
node[name] >> val_tmp ;
val = (uint16_t)val_tmp;
res=true;
- }catch ( const std::exception& e ) {
}
}
@@ -113,10 +110,9 @@ bool utl_yaml_read_bool(const YAML::Node& node,
std::string name,
bool & val){
bool res=false;
- try {
+ if ( node.FindValue(name) ) {
node[name] >> val ;
res=true;
- }catch ( const std::exception& e ) {
}
return( res);
}