I assumed the o was a typo in Jörg's version for '\0' (NUL char constant if 
that gets mangled
in posting).  Aside from that, I went with

        if (p2 == NULL)
                return (len);

        return (p2 - p);

(but with better variable names) rather than the conditional operator, so as 
not to look like
the (I won't say whose) version.  I'd expect any decent compiler would generate 
pretty much
the same thing either way.  If there's already an efficient memchr(), I suspect 
there's only
just so many ways to do this, so that's as far as I'm inclined to go, esp. 
since aside from the
removal of a check for a NULL string arg and an error (incorrect + 1) at the 
end, and
better variable names, what I ended up with is from the private version in
usr/src/lib/abi/apptrace/common/interceptlib.c.  And it also passes all the 
tests I had
already, and is even all prettied up now.
 
 
This message posted from opensolaris.org
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to