[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] With PERMISSIVE turned on, diagnose missing Enums and Bools, and improve the
# HG changeset patch # User Ewan Mellor <ewan@xxxxxxxxxxxxx> # Node ID 38ad5643aafef916c4411b0d28aa56277c4ff70c # Parent fd28a1b139dea91b8bfcf06dd233dbdda8f51ff1 With PERMISSIVE turned on, diagnose missing Enums and Bools, and improve the diagnosis of missing structure values. Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx> --- tools/libxen/src/xen_common.c | 20 ++++++++++++++++++-- 1 files changed, 18 insertions(+), 2 deletions(-) diff -r fd28a1b139de -r 38ad5643aafe tools/libxen/src/xen_common.c --- a/tools/libxen/src/xen_common.c Mon Dec 04 09:29:26 2006 +0000 +++ b/tools/libxen/src/xen_common.c Mon Dec 04 10:20:56 2006 +0000 @@ -518,8 +518,14 @@ static void parse_into(xen_session *s, x xmlChar *string = string_from_value(value_node, "string"); if (string == NULL) { +#if PERMISSIVE + fprintf(stderr, + "Expected an Enum from the server, but didn't get one\n"); + ((int *)value)[slot] = 0; +#else server_error( s, "Expected an Enum from the server, but didn't get one"); +#endif } else { @@ -567,8 +573,14 @@ static void parse_into(xen_session *s, x xmlChar *string = string_from_value(value_node, "boolean"); if (string == NULL) { +#if PERMISSIVE + fprintf(stderr, + "Expected a Bool from the server, but didn't get one\n"); + ((bool *)value)[slot] = false; +#else server_error( s, "Expected a Bool from the server, but didn't get one"); +#endif } else { @@ -764,7 +776,6 @@ static void parse_into(xen_session *s, x cur = cur->next; } -#if !PERMISSIVE /* Check that we've filled all fields. */ for (size_t i = 0; i < member_count; i++) { @@ -781,15 +792,20 @@ static void parse_into(xen_session *s, x if (j == seen_count) { +#if PERMISSIVE + fprintf(stderr, + "Struct did not contain expected field %s.\n", + mem->key); +#else server_error_2(s, "Struct did not contain expected field", mem->key); free(result); free(checklist); return; +#endif } } -#endif free(checklist); ((void **)value)[slot] = result; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |