util: fix various ATTRIBUTE_NONNULL calls

Git bisect took me to commit where incorrect usage of ATTRIBUTE_NONNULL
was introduced and caused coverity scan to fail. This patch fixes the
issue where the index starts from 1 and not 0 and two other different
cases.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Pavel Hrdina 2021-11-19 18:01:23 +01:00
parent d20ebdda28
commit 23b99623ee
3 changed files with 11 additions and 11 deletions

View File

@ -53,7 +53,7 @@ void virAppendElement(void *ptrptr,
void *newelem, void *newelem,
bool clearOriginal, bool clearOriginal,
bool inPlace) bool inPlace)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
int virDeleteElementsN(void *ptrptr, size_t size, size_t at, size_t *countptr, int virDeleteElementsN(void *ptrptr, size_t size, size_t at, size_t *countptr,
size_t toremove, bool inPlace) size_t toremove, bool inPlace)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4);

View File

@ -82,7 +82,7 @@ int virNetDevOpenvswitchInterfaceClearQos(const char *ifname,
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT;
int virNetDevOpenvswitchInterfaceClearRxQos(const char *ifname) int virNetDevOpenvswitchInterfaceClearRxQos(const char *ifname)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
int virNetDevOpenvswitchInterfaceClearTxQos(const char *ifname, int virNetDevOpenvswitchInterfaceClearTxQos(const char *ifname,
const unsigned char *vmid) const unsigned char *vmid)

View File

@ -109,14 +109,14 @@ virXMLPropTristateBool(xmlNodePtr node,
const char *name, const char *name,
virXMLPropFlags flags, virXMLPropFlags flags,
virTristateBool *result) virTristateBool *result)
ATTRIBUTE_NONNULL(0) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4);
int int
virXMLPropTristateSwitch(xmlNodePtr node, virXMLPropTristateSwitch(xmlNodePtr node,
const char *name, const char *name,
virXMLPropFlags flags, virXMLPropFlags flags,
virTristateSwitch *result) virTristateSwitch *result)
ATTRIBUTE_NONNULL(0) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4);
int int
virXMLPropInt(xmlNodePtr node, virXMLPropInt(xmlNodePtr node,
@ -125,7 +125,7 @@ virXMLPropInt(xmlNodePtr node,
virXMLPropFlags flags, virXMLPropFlags flags,
int *result, int *result,
int defaultResult) int defaultResult)
ATTRIBUTE_NONNULL(0) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5);
int int
virXMLPropUInt(xmlNodePtr node, virXMLPropUInt(xmlNodePtr node,
@ -133,7 +133,7 @@ virXMLPropUInt(xmlNodePtr node,
int base, int base,
virXMLPropFlags flags, virXMLPropFlags flags,
unsigned int *result) unsigned int *result)
ATTRIBUTE_NONNULL(0) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5);
int int
virXMLPropULongLong(xmlNodePtr node, virXMLPropULongLong(xmlNodePtr node,
@ -141,7 +141,7 @@ virXMLPropULongLong(xmlNodePtr node,
int base, int base,
virXMLPropFlags flags, virXMLPropFlags flags,
unsigned long long *result) unsigned long long *result)
ATTRIBUTE_NONNULL(0) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4); ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5);
int int
virXMLPropEnum(xmlNodePtr node, virXMLPropEnum(xmlNodePtr node,
@ -149,8 +149,8 @@ virXMLPropEnum(xmlNodePtr node,
int (*strToInt)(const char*), int (*strToInt)(const char*),
virXMLPropFlags flags, virXMLPropFlags flags,
unsigned int *result) unsigned int *result)
ATTRIBUTE_NONNULL(0) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_NONNULL(4); ATTRIBUTE_NONNULL(5);
int int
virXMLPropEnumDefault(xmlNodePtr node, virXMLPropEnumDefault(xmlNodePtr node,
@ -159,8 +159,8 @@ virXMLPropEnumDefault(xmlNodePtr node,
virXMLPropFlags flags, virXMLPropFlags flags,
unsigned int *result, unsigned int *result,
unsigned int defaultResult) unsigned int defaultResult)
ATTRIBUTE_NONNULL(0) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_NONNULL(4); ATTRIBUTE_NONNULL(5);
/* Internal function; prefer the macros below. */ /* Internal function; prefer the macros below. */