conf: No need to check for usage fields during Format

Since the virSecretDefParseUsage ensures each of the fields is present,
no need to check during virSecretDefFormatUsage (also virBufferEscapeString
is a no-op with a NULL argument).

Signed-off-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
John Ferlan 2016-06-24 10:25:15 -04:00
parent 47a0866bce
commit 3977c386f6
1 changed files with 3 additions and 11 deletions

View File

@ -286,23 +286,15 @@ virSecretDefFormatUsage(virBufferPtr buf,
break;
case VIR_SECRET_USAGE_TYPE_VOLUME:
if (def->usage.volume != NULL)
virBufferEscapeString(buf, "<volume>%s</volume>\n",
def->usage.volume);
virBufferEscapeString(buf, "<volume>%s</volume>\n", def->usage.volume);
break;
case VIR_SECRET_USAGE_TYPE_CEPH:
if (def->usage.ceph != NULL) {
virBufferEscapeString(buf, "<name>%s</name>\n",
def->usage.ceph);
}
virBufferEscapeString(buf, "<name>%s</name>\n", def->usage.ceph);
break;
case VIR_SECRET_USAGE_TYPE_ISCSI:
if (def->usage.target != NULL) {
virBufferEscapeString(buf, "<target>%s</target>\n",
def->usage.target);
}
virBufferEscapeString(buf, "<target>%s</target>\n", def->usage.target);
break;
default: