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:
@@ -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) { \
|
||||
|
||||
Reference in New Issue
Block a user