mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
lib: Annotate more function as NULL terminated
While __attribute((sentinel)) (exposed by glib under G_GNUC_NULL_TERMINATED macro) is a gcc extension, it's supported by clang too. It's already being used throughout our code but some functions that take variadic arguments and expect NULL at the end were lacking such annotation. Fill them in. After this, there are still some functions left untouched because they expect a different sentinel than NULL. Unfortunately, glib does not provide macro for different sentinels. We may come up with our own, but let's save that for future work. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
9d0c8618db
commit
86e511fafb
@ -947,7 +947,8 @@ int qemuMonitorDelDevice(qemuMonitor *mon,
|
|||||||
int qemuMonitorCreateObjectProps(virJSONValue **propsret,
|
int qemuMonitorCreateObjectProps(virJSONValue **propsret,
|
||||||
const char *type,
|
const char *type,
|
||||||
const char *alias,
|
const char *alias,
|
||||||
...);
|
...)
|
||||||
|
G_GNUC_NULL_TERMINATED;
|
||||||
|
|
||||||
int qemuMonitorAddObject(qemuMonitor *mon,
|
int qemuMonitorAddObject(qemuMonitor *mon,
|
||||||
virJSONValue **props,
|
virJSONValue **props,
|
||||||
|
@ -468,7 +468,7 @@ qemuMonitorJSONHasError(virJSONValue *reply,
|
|||||||
*
|
*
|
||||||
* Returns 0 on success and -1 on error.
|
* Returns 0 on success and -1 on error.
|
||||||
*/
|
*/
|
||||||
static int
|
static int G_GNUC_NULL_TERMINATED
|
||||||
qemuMonitorJSONTransactionAdd(virJSONValue *actions,
|
qemuMonitorJSONTransactionAdd(virJSONValue *actions,
|
||||||
const char *cmdname,
|
const char *cmdname,
|
||||||
...)
|
...)
|
||||||
|
@ -39,7 +39,7 @@ static virQEMUDriver driver;
|
|||||||
|
|
||||||
static virBuffer testnamebuf = VIR_BUFFER_INITIALIZER;
|
static virBuffer testnamebuf = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
static const char *
|
static const char * G_GNUC_NULL_TERMINATED
|
||||||
tn(const char *str, ...)
|
tn(const char *str, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
@ -113,7 +113,8 @@ void virTestFakeRootDirCleanup(char *fakerootdir);
|
|||||||
int virTestMain(int argc,
|
int virTestMain(int argc,
|
||||||
char **argv,
|
char **argv,
|
||||||
int (*func)(void),
|
int (*func)(void),
|
||||||
...);
|
...)
|
||||||
|
G_GNUC_NULL_TERMINATED;
|
||||||
|
|
||||||
/* Setup, then call func() */
|
/* Setup, then call func() */
|
||||||
#define VIR_TEST_MAIN(func) \
|
#define VIR_TEST_MAIN(func) \
|
||||||
|
@ -40,7 +40,8 @@ testQEMUSchemaValidateCommand(const char *command,
|
|||||||
|
|
||||||
int
|
int
|
||||||
testQEMUSchemaEntryMatchTemplate(virJSONValue *schemaentry,
|
testQEMUSchemaEntryMatchTemplate(virJSONValue *schemaentry,
|
||||||
...);
|
...)
|
||||||
|
G_GNUC_NULL_TERMINATED;
|
||||||
|
|
||||||
|
|
||||||
virJSONValue *
|
virJSONValue *
|
||||||
|
@ -2418,7 +2418,7 @@ vshCloseLogFile(vshControl *ctl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
static void
|
static void G_GNUC_NULL_TERMINATED
|
||||||
vshPrintRaw(vshControl *ctl, ...)
|
vshPrintRaw(vshControl *ctl, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
Loading…
Reference in New Issue
Block a user