In fact, don't waste time incrementing the pointer or decrementing the
count until we know that we're going to go through another trip through
the loop. (This isn't a PDP-11 and probably isn't a VAX or 68k, so *p++
isn't going to be done by an addressing mode.)
This should fix an undefined-behavior warning.
static int
iszero(const u_char *p, size_t l)
{
- while (l--) {
- if (*p++)
+ while (l != 0) {
+ if (*p)
return 0;
+ p++;
+ l--;
}
return 1;
}