In many cases we use a signed value, but use the sign to note that it
was not assigned. For converting to JSON objects it will be handy to
have possibility to do this automatically.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
*
* i: signed integer value
* j: signed integer value, error if negative
+ * k: signed integer value, omitted if negative
* z: signed integer value, omitted if zero
* y: signed integer value, omitted if zero, error if negative
*
case 'z':
case 'y':
+ case 'k':
case 'j':
case 'i': {
int val = va_arg(args, int);
if (!val && (type == 'z' || type == 'y'))
continue;
+ if (val < 0 && type == 'k')
+ continue;
+
rc = virJSONValueObjectAppendNumberInt(obj, key, val);
} break;