|
From: | David Empson |
Subject: | Re: [lwip-users] what this error is for???? |
Date: | Mon, 16 Jun 2008 14:56:17 +1200 |
According to debug.h, LWIP_ERROR is supposed to be
defined as follows, unless you have your own definition:
#define LWIP_ERROR(m,e,h) do { if (!(e)) {
LWIP_PLATFORM_ASSERT(m); h;}} while (0)
In other words, LWIP_ERROR does an assertion if the
_expression_ in the second parameter is FALSE.
In this specific case, the test is confirming that
netif is not equal to NULL, which is required for the operation of
etharp_ip_input(). If netif is NULL, it prints the error message and returns. If
netif is not NULL, the code continues as normal.
There have been some changes in this
area since LWIP 1.2.0. In that version, LWIP_ERROR() had one parameter and
simply printed an error message, and the corresponding code in etharp.c used
LWIP_ASSERT().
Perhaps you have your own implementation of
LWIP_ERROR which has the test condition reversed? Make sure it is testing for
the second parameter not being true.
Alternatively, perhaps you have occasions where
this function is being called with netif equal to NULL, which will trigger that
LWIP_ERROR.
Personally, I think this notation is confusing. If
I hadn't looked at the header files, I'd assume something called "LWIP_ERROR"
means "It is an error if the following condition is true". It actually means the
opposite. In my opinion, this should be using the term ASSERT in some way,
rather than ERROR.
----- Original Message -----
|
[Prev in Thread] | Current Thread | [Next in Thread] |