On 04/14/2010 10:02 AM, Jim Meyering wrote:
From: Jim Meyering <meyering(a)redhat.com>
* src/xen/xend_internal.c (xend_parse_sexp_desc_char): Add three
uses of sa_assert, each preceding a strchr(value,... to assure
clang that "value" is non-NULL.
---
src/xen/xend_internal.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index c4e73b7..950f1b5 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -1284,6 +1284,7 @@ xend_parse_sexp_desc_char(virBufferPtr buf,
virBufferVSprintf(buf, " <source path='%s'/>\n",
value);
} else if (STREQ(type, "tcp")) {
+ sa_assert (value);
const char *offset = strchr(value, ':');
This introduces an expression before a declaration, even when sa_assert
is empty. I know that we already rely on several other C99 features
(like __VA_ARGS__ from the preprocessor), but my understanding has been
that we have been trying to stick with C89 declarations first still.
Does this need to be refactored accordingly?
Besides, xend_parse_sexp_desc_char already dereferences value at line
1224; would it be possible to fix this by marking the argument as
NONNULL, rather than adding sa_assert()?
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org