From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35286) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJ5Rs-0004kj-OX for qemu-devel@nongnu.org; Fri, 22 Mar 2013 13:08:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UJ5Rr-0005Oa-F9 for qemu-devel@nongnu.org; Fri, 22 Mar 2013 13:08:12 -0400 Received: from e7.ny.us.ibm.com ([32.97.182.137]:48338) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UJ5Rr-0005Lq-AX for qemu-devel@nongnu.org; Fri, 22 Mar 2013 13:08:11 -0400 Received: from /spool/local by e7.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 22 Mar 2013 13:07:54 -0400 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id 333BCC9004A for ; Fri, 22 Mar 2013 13:07:51 -0400 (EDT) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r2MH7p8b292560 for ; Fri, 22 Mar 2013 13:07:51 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r2MH7ohV005453 for ; Fri, 22 Mar 2013 14:07:50 -0300 Message-ID: <514C8FE5.2030801@linux.vnet.ibm.com> Date: Fri, 22 Mar 2013 13:07:49 -0400 From: Stefan Berger MIME-Version: 1.0 References: <1363890571-15146-1-git-send-email-stefanb@linux.vnet.ibm.com> <1363890571-15146-10-git-send-email-stefanb@linux.vnet.ibm.com> <514B8441.7050408@redhat.com> In-Reply-To: <514B8441.7050408@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 9/9] ASN.1 specific test cases List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: mst@redhat.com, coreyb@linux.vnet.ibm.com, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, jschopp@linux.vnet.ibm.com, anthony@codemonkey.ws 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