apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@gmail.com>
Subject Re: test function looks a bit strange ...
Date Mon, 12 Oct 2009 21:37:08 GMT
On Mon, Oct 12, 2009 at 5:31 PM, Guenter Knauf <fuankg@apache.org> wrote:
> Hi,
> in abts.c we have:
>
> void abts_ptr_notnull(abts_case *tc, const void *ptr, int lineno)
> {
>    update_status();
>    if (tc->failed) return;
>
>    if (ptr != NULL) return;
>
>    tc->failed = TRUE;
>    if (verbose) {
>        fprintf(stderr, "Line %d: Expected NULL, but saw <%p>\n",
> lineno, ptr);
>        fflush(stderr);
>    }
> }
>
> it looks like the function returns if ptr != NULL (which also fits to
> its name), but if ptr == NULL then we write a wrong error message, and
> then try to print that NULL pointer ...?
> Shouldnt that be:
> -        fprintf(stderr, "Line %d: Expected NULL, but saw <%p>\n",
> lineno, ptr);
> +        fprintf(stderr, "Line %d: Expected non-NULL, but got NULL\n",
> lineno);

+1

Mime
View raw message