summaryrefslogtreecommitdiff
path: root/src/internal.h
diff options
context:
space:
mode:
authorPeter Krempa <pkrempa@redhat.com>2015-06-23 17:35:16 +0200
committerPeter Krempa <pkrempa@redhat.com>2015-06-26 16:05:10 +0200
commit14062e6fe5a71699b85fbbbb1cada2a42cd48dbb (patch)
tree5f9695e24466c8f8ded55b1af1f235fc6ee84a85 /src/internal.h
parentd637017f9b2b6297cd88975c92e377f04fce0671 (diff)
downloadlibvirt-14062e6fe5a71699b85fbbbb1cada2a42cd48dbb.tar.gz
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.
Diffstat (limited to 'src/internal.h')
-rw-r--r--src/internal.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/internal.h b/src/internal.h
index 7c042e0dba..db26fb077c 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -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) { \