Fix some wrong usage of ATTRIBUTE_NONNULL()

The virStateInitialize() function has ATTRIBUTE_NONNULL()
referring to @root argument (incorrectly anyway) but in
daemonRunStateInit() NULL is passed in anyway.

Then there is virCommandAddArgPair() which also has
ATTRIBUTE_NONNULL() for one of its arguments and then checks the
argument for being NULL anyways.

Signed-off-by:Bihong Yu <yubihong@huawei.com>
Reviewed-by:Chuan Zheng <zhengchuan@huawei.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Bihong Yu 2020-06-06 18:52:35 +08:00 committed by Michal Privoznik
parent f225f37a8a
commit 2a372a5ad5
2 changed files with 2 additions and 4 deletions

View File

@ -33,8 +33,7 @@ int virStateInitialize(bool privileged,
bool mandatory, bool mandatory,
const char *root, const char *root,
virStateInhibitCallback inhibit, virStateInhibitCallback inhibit,
void *opaque) void *opaque);
ATTRIBUTE_NONNULL(2);
int virStateCleanup(void); int virStateCleanup(void);
int virStateReload(void); int virStateReload(void);
int virStateStop(void); int virStateStop(void);

View File

@ -126,8 +126,7 @@ void virCommandAddArgFormat(virCommandPtr cmd,
void virCommandAddArgPair(virCommandPtr cmd, void virCommandAddArgPair(virCommandPtr cmd,
const char *name, const char *name,
const char *val) const char *val);
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
void virCommandAddArgSet(virCommandPtr cmd, void virCommandAddArgSet(virCommandPtr cmd,
const char *const*vals) ATTRIBUTE_NONNULL(2); const char *const*vals) ATTRIBUTE_NONNULL(2);