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

Re: [libvirt] [PATCH 10/10] tests: virerror: Make sure that error messages stay in correct order



On Wed, Dec 05, 2018 at 05:47:51PM +0100, Peter Krempa wrote:
> Since we don't look up the error message according to the error code but
> they have to be in the correct order in virErrorMsgStrings, we need
> to make sure that they stay in the correct order.
>
> Signed-off-by: Peter Krempa <pkrempa redhat com>
> ---
>  tests/virerrortest.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/tests/virerrortest.c b/tests/virerrortest.c
> index 0d0377bfa8..6d333f02d0 100644
> --- a/tests/virerrortest.c
> +++ b/tests/virerrortest.c
> @@ -87,6 +87,24 @@ virErrorTestMsgs(const void *opaque ATTRIBUTE_UNUSED)
>  }
>
>
> +static int
> +virErrorTestMsgOrder(const void *opaque ATTRIBUTE_UNUSED)
> +{
> +    size_t i;
> +    int ret = 0;
> +
> +    for (i = 0; i < VIR_ERR_NUMBER_LAST; i++) {
> +        if (i != virErrorMsgStrings[i].error) {

I hope coverity is smart enough not to think that ^^this is a comparison
between a signed and unsigned integer.

Reviewed-by: Erik Skultety <eskultet redhat com>


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