apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guenter Knauf <fua...@apache.org>
Subject test function looks a bit strange ...
Date Mon, 12 Oct 2009 21:31:45 GMT
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);

??

Gün.



Mime
View raw message