
On Wed, Mar 29, 2017 at 03:51:54PM +0200, Peter Krempa wrote:
On Wed, Mar 29, 2017 at 14:51:13 +0200, Erik Skultety wrote:
Make the code look cleaner by moving the capability specific bits into separate functions.
Signed-off-by: Erik Skultety <eskultet@redhat.com> --- src/conf/node_device_conf.c | 578 ++++++++++++++++++++++++-------------------- 1 file changed, 322 insertions(+), 256 deletions(-)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 7d0baa9d1a..72fb9a5611 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -155,6 +155,320 @@ virPCIEDeviceInfoFormat(virBufferPtr buf, }
+static void +virNodeDeviceCapSystemDefFormat(virBufferPtr buf, + const virNodeDevCapData *data) +{ + char uuidstr[VIR_UUID_STRING_BUFLEN]; + + if (data->system.product_name) + virBufferEscapeString(buf, "<product>%s</product>\n", + data->system.product_name); + virBufferAddLit(buf, "<hardware>\n"); + virBufferAdjustIndent(buf, 2); + if (data->system.hardware.vendor_name) + virBufferEscapeString(buf, "<vendor>%s</vendor>\n", + data->system.hardware.vendor_name); + if (data->system.hardware.version) + virBufferEscapeString(buf, "<version>%s</version>\n", + data->system.hardware.version);
virBufferEscapeString automatically skips formatting of the whole string if the argument is NULL. So the condition is not necessary.
Again, you're right, but in this case, I was merely moving bits to separate functions without reviewing the code. Also, it's a fair amount of occurrences, so for the sake of the future reviewer, aka non-shredder :D, I will adjust this in a separate patch. Erik