diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-11-17 13:52:22 +0000 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-11-17 13:52:22 +0000 |
commit | 1739042f3431e5b399db0cf49106c98478436a2f (patch) | |
tree | 7dcbeb92d3f8b1f60238ade51653b1cbb770d172 | |
parent | 74582de06ccdd5bcec1aa7ed9f77854a765da4e0 (diff) | |
download | subsurface-1739042f3431e5b399db0cf49106c98478436a2f.tar.gz |
Use cylinder use helper function
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | load-git.c | 8 | ||||
-rw-r--r-- | parse-xml.c | 10 |
2 files changed, 4 insertions, 14 deletions
diff --git a/load-git.c b/load-git.c index 54d349bd0..459d8d117 100644 --- a/load-git.c +++ b/load-git.c @@ -264,12 +264,8 @@ static void parse_cylinder_keyvalue(void *_cylinder, const char *key, const char return; } if (!strcmp(key, "use")) { - for (enum cylinderuse i = 0; i < NUM_GAS_USE; i++) { - if (same_string(value, cylinderuse_text[i])) { - cylinder->cylinder_use = i; - return; - } - } + cylinder->cylinder_use = cylinderuse_from_text(value); + return; } report_error("Unknown cylinder key/value pair (%s/%s)", key, value); } diff --git a/parse-xml.c b/parse-xml.c index 24911b0b6..79fd49661 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -338,14 +338,8 @@ static void pressure(char *buffer, pressure_t *pressure) static void cylinder_use(char *buffer, enum cylinderuse *cyl_use) { - if (trimspace(buffer)) { - for (enum cylinderuse i = 0; i < NUM_GAS_USE; i++) { - if (same_string(buffer, cylinderuse_text[i])) { - *cyl_use = i; - return; - } - } - } + if (trimspace(buffer)) + *cyl_use = cylinderuse_from_text(buffer); } static void salinity(char *buffer, int *salinity) |