TYPE_NONE equals to 0, and we use it for the default value of entity's
messenger protocol version, if it is not specified. but we always use
TYPE_DEFAULT for the protocol version if it's not specified in the
parsed string or the parameter.
so we can just simplify the logic by assigning it to `newtype`, and
assign the parse value to `new_type` for better readability.
Signed-off-by: Kefu Chai <kchai@redhat.com>
*end = s;
}
- int newtype;
+ int newtype = default_type;
if (strncmp("v1:", s, 3) == 0) {
start += 3;
newtype = TYPE_LEGACY;
*end = s + 1;
}
return true;
- } else {
- newtype = default_type ? default_type : TYPE_DEFAULT;
}
bool brackets = false;
}
bool parse(const std::string_view s, int default_type=TYPE_DEFAULT);
- bool parse(const char *s, const char **end = 0, int type=0);
+ bool parse(const char *s, const char **end = 0, int default_type=TYPE_DEFAULT);
void decode_legacy_addr_after_marker(ceph::buffer::list::const_iterator& bl)
{