[libvirt] [PATCH] Add test suite for viralloc APIs
Eric Blake
eblake at redhat.com
Thu Apr 24 22:00:35 UTC 2014
On 04/24/2014 02:25 PM, Nehal J Wani wrote:
>>>> +static int
>>>> +testAllocScalar(const void *opaque ATTRIBUTE_UNUSED)
>>>> +{
>>>> + testDummyStruct *t;
>>>> + int ret = -1;
>>>> +
>>>> + if (VIR_ALLOC(t) < 0)
>>>> + return -1;
>>>> +
>>>> + if (t == NULL) {
>>>> + fprintf(stderr, "Allocation succeeded by pointer is NULL\n");
>>>> + goto cleanup;
>>>> + }
>>>
>>> Just out of curiosity, why don't we have this check after
>>> VIR_REALLOC_N, VIR_EXPAND_N, VIR_SHRINK_N and VIR_RESIZE_N ?
>
> As this patch hasn't been pushed yet, maybe the following can be squashed in?
>
> diff --git a/tests/viralloctest.c b/tests/viralloctest.c
> index abdd871..d5818c7 100644
> --- a/tests/viralloctest.c
> +++ b/tests/viralloctest.c
> @@ -33,6 +33,17 @@ typedef struct testDummyStruct {
> } testDummyStruct;
>
> static int
> +testCheckNonNull(void *t)
> +{
> + if (t == NULL) {
> + fprintf(stderr, "Allocation succeeded by pointer is NULL\n");
s/by/but/
Looks reasonable to me.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140424/04969ddd/attachment-0001.sig>
More information about the libvir-list
mailing list