Skip to content

Commit

Permalink
Per #2224, update existing parse_conf_nbrhd() function to skip parsin…
Browse files Browse the repository at this point in the history
…g the field entry for the nbrhd_prob. This seems preferable to all the duplication involved in writing a new parse_conf_nbrhd_prob() function.
  • Loading branch information
JohnHalleyGotway committed Nov 2, 2022
1 parent 4405b80 commit 96cf9e2
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/basic/vx_config/config_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1731,11 +1731,18 @@ NbrhdInfo parse_conf_nbrhd(Dictionary *dict, const char *conf_key) {
nbrhd_dict = dict->lookup_dictionary(conf_key);

// Conf: field - may be missing
v = nbrhd_dict->lookup_int(conf_key_field, false);

// If found, interpret value. Otherwise, default to BOTH
if(nbrhd_dict->last_lookup_status()) info.field = int_to_fieldtype(v);
else info.field = FieldType_Both;
// Default info.field to BOTH
info.field = FieldType_Both;

// Skip lookup for conf_key_nbrhd_prob
if(strncmp(conf_key, conf_key_nbrhd_prob, strlen(conf_key_nbrhd_prob)) != 0) {

v = nbrhd_dict->lookup_int(conf_key_field, false);

// If found, interpret value
if(nbrhd_dict->last_lookup_status()) info.field = int_to_fieldtype(v);
}

// Conf: vld_thresh
info.vld_thresh = nbrhd_dict->lookup_double(conf_key_vld_thresh);
Expand Down

0 comments on commit 96cf9e2

Please sign in to comment.