1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-07-07 16:58:58 +03:00

cleanup: put all tests within switch

No reason to check for VALID in extra if.
This commit is contained in:
Zdenek Kabelac
2014-04-28 10:17:30 +02:00
parent d1aba7ccf6
commit d8214cb154

View File

@ -840,31 +840,32 @@ void display_tags(const struct cmd_context *cmd)
void display_name_error(name_error_t name_error) void display_name_error(name_error_t name_error)
{ {
if (name_error != NAME_VALID) {
switch(name_error) { switch(name_error) {
case NAME_VALID:
/* Valid name */
break;
case NAME_INVALID_EMPTY: case NAME_INVALID_EMPTY:
log_error("Name is zero length"); log_error("Name is zero length.");
break; break;
case NAME_INVALID_HYPEN: case NAME_INVALID_HYPEN:
log_error("Name cannot start with hyphen"); log_error("Name cannot start with hyphen.");
break; break;
case NAME_INVALID_DOTS: case NAME_INVALID_DOTS:
log_error("Name starts with . or .. and has no " log_error("Name starts with . or .. and has no "
"following character(s)"); "following character(s).");
break; break;
case NAME_INVALID_CHARSET: case NAME_INVALID_CHARSET:
log_error("Name contains invalid character, valid set includes: " log_error("Name contains invalid character, valid set includes: "
"[a-zA-Z0-9.-_+]"); "[a-zA-Z0-9.-_+].");
break; break;
case NAME_INVALID_LENGTH: case NAME_INVALID_LENGTH:
/* Report that name length -1 to accommodate nul*/ /* Report that name length - 1 to accommodate nul*/
log_error("Name length exceeds maximum limit of %d", (NAME_LEN -1)); log_error("Name length exceeds maximum limit of %d.", (NAME_LEN - 1));
break; break;
default: default:
log_error("Unknown error %d on name validation", name_error); log_error(INTERNAL_ERROR "Unknown error %d on name validation.", name_error);
break; break;
} }
}
} }
/* /*