qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 9/9] ASN.1 specific test cases


From: Stefan Berger
Subject: Re: [Qemu-devel] [PATCH v4 9/9] ASN.1 specific test cases
Date: Fri, 22 Mar 2013 13:07:49 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1

On 03/21/2013 06:05 PM, Eric Blake wrote:
On 03/21/2013 12:29 PM, Stefan Berger wrote:
+tests/test-ber-visitor.o: $(addprefix include/qapi/, ber.h ber-input-visitor.h 
ber-output-visitor.h) $(addprefix qapi/, ber-common.c ber-input-visitor.c 
ber-output-visitor.c)
+tests/test-ber-visitor$(EXESUF): tests/test-ber-visitor.o $(tools-obj-y) 
qapi/ber-output-visitor.o qapi/ber-input-visitor.o qapi/ber-common.o 
$(block-obj-y) libqemuutil.a libqemustub.a
Long lines - worth using backslash-newline continuation?

Yes. Others are long but these lines are now the longest.


+++ b/tests/test-ber-visitor.c
@@ -0,0 +1,746 @@
+/*
+ * BER Output Visitor unit-tests.
+ *
+ * Copyright (C) 2011 Red Hat Inc.
+ * Copyright (C) 2011 IBM Corporation
It's 2013 (probably applies to other files earlier in the series, as well).

+static void test_visitor_out_string(TestInputOutputVisitor *data,
+                                    const void *unused)
+{
+    char *string_in = (char *) "Q E M U", *string_out = NULL;
Does the fact that you have to cast here...

+    Error *errp = NULL;
+
+    visit_type_str(data->ov, &string_in, NULL, &errp);
...indicate a lack of const-correctness on visit_type_str()?


The visitor interface is used for serialization and de-serialization. Upon de-serialization the underlying visitor can allocate memory for the string it found while decoding, so you can pass in a pointer to a NULL pointer and will get a valid pointer to the string back.

   Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]