1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-11-23 04:24:24 +03:00

internal: Introduce virCheckNonEmptyStringArgGoto and reuse it

The helper makes sure that strings passed to APIs are non-NULL and
non-empty. This allows to drop some inlined checks where it does not
make sense.
This commit is contained in:
Peter Krempa
2015-06-23 17:35:16 +02:00
parent d637017f9b
commit 14062e6fe5
4 changed files with 24 additions and 13 deletions

View File

@@ -446,6 +446,17 @@
goto label; \
} \
} while (0)
# define virCheckNonEmptyStringArgGoto(argname, label) \
do { \
if (argname == NULL) { \
virReportInvalidNonNullArg(argname); \
goto label; \
} \
if (*argname == '\0') { \
virReportInvalidEmptyStringArg(argname); \
goto label; \
} \
} while (0)
# define virCheckPositiveArgGoto(argname, label) \
do { \
if (argname <= 0) { \