diff options
| author | Patrick Venture <venture@google.com> | 2019-08-29 09:35:19 -0700 |
|---|---|---|
| committer | Patrick Venture <venture@google.com> | 2019-08-29 09:49:43 -0700 |
| commit | c7ab57e9bdbcc7aa51c51f89aff5aa0898882ee2 (patch) | |
| tree | 8332cfe1d1d397f0c7a1c44d9b5c2b46bbdb77db | |
| parent | a7ec8350d17b70153cebe666d3fbe88bddd02a1a (diff) | |
| download | phosphor-pid-control-c7ab57e9bdbcc7aa51c51f89aff5aa0898882ee2.tar.gz phosphor-pid-control-c7ab57e9bdbcc7aa51c51f89aff5aa0898882ee2.zip | |
sensors: buildjson: minor min/max cleanup
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I9d01753a40f1146d49e1a03a18dbea704f3fff84
| -rw-r--r-- | sensors/buildjson.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/sensors/buildjson.cpp b/sensors/buildjson.cpp index 42a9286..f5449eb 100644 --- a/sensors/buildjson.cpp +++ b/sensors/buildjson.cpp @@ -41,24 +41,19 @@ void from_json(const json& j, conf::SensorConfig& s) j.at("writePath").get_to(s.writePath); } + s.min = 0; + s.max = 0; + /* The min field is optional in a configuration. */ auto min = j.find("min"); - if (min == j.end()) - { - s.min = 0; - } - else + if (min != j.end()) { j.at("min").get_to(s.min); } /* The max field is optional in a configuration. */ auto max = j.find("max"); - if (max == j.end()) - { - s.max = 0; - } - else + if (max != j.end()) { j.at("max").get_to(s.max); } |

