diff options
author | Jeff Darcy <jdarcy@fb.com> | 2017-10-31 09:56:11 -0700 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2017-11-03 05:04:11 +0000 |
commit | 8e973d3ab96d290a32ae3fdbdd1cf867b7060483 (patch) | |
tree | dc20dca53f16dba3489d65837007e87bb4c84650 /xlators/cluster/dht/src/dht-shared.c | |
parent | 917f84b01ff4c485ce548f0daa3d3d51dc81c195 (diff) |
core: make gf_boolean_t a C99 bool instead of an enum
This reduces the space used from four bytes to one, and allows
new code to use familiar C99 types/values interoperably with our
old cruft. It does *not* change current declarations or code;
that will be left for a separate - much larger - patch.
Updates: #80
Change-Id: I5baedd17d3fb05b38f0d8b8bb9dd62824475842e
Signed-off-by: Jeff Darcy <jdarcy@fb.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-shared.c')
-rw-r--r-- | xlators/cluster/dht/src/dht-shared.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/xlators/cluster/dht/src/dht-shared.c b/xlators/cluster/dht/src/dht-shared.c index 38de31d1ec9..f6ca8bd0926 100644 --- a/xlators/cluster/dht/src/dht-shared.c +++ b/xlators/cluster/dht/src/dht-shared.c @@ -769,13 +769,18 @@ dht_init (xlator_t *this) if (dict_get_str (this->options, "lookup-unhashed", &temp_str) == 0) { /* If option is not "auto", other options _should_ be boolean */ if (strcasecmp (temp_str, "auto")) { - ret = gf_string2boolean (temp_str, - &conf->search_unhashed); - if (ret == -1) + gf_boolean_t search_unhashed_bool; + ret = gf_string2boolean (temp_str, &search_unhashed_bool); + if (ret == -1) { goto err; + } + conf->search_unhashed = search_unhashed_bool + ? GF_DHT_LOOKUP_UNHASHED_ON + : GF_DHT_LOOKUP_UNHASHED_OFF; } - else + else { conf->search_unhashed = GF_DHT_LOOKUP_UNHASHED_AUTO; + } } GF_OPTION_INIT ("lookup-optimize", conf->lookup_optimize, bool, err); |