[Xcb] [Bug 4232] xlsclients much too slow over network

Josh Triplett josh at joshtriplett.org
Fri Sep 4 07:51:18 PDT 2009


On Thu, Sep 03, 2009 at 01:15:29PM -0700, Ian Osgood wrote:
> 
> On Sep 2, 2009, at 8:49 AM, Peter Harris wrote:
> 
> >  - Re-implement strnlen for people who have only ISO C.
> >
> > Peter Harris
> 
> How about using memchr?  (I don't know what kind of #ifdefs to wrap  
> this in, though.)
> 
> size_t strnlen(const char *s, size_t len)
> {
> 	const char *end = (const char *)memchr(s, 0, len);
> 	return end ? end-s : len;
> }

That looks good.  As for the ifdefs, you'd probably need to add an
autoconf test for the strnlen function and then use "ifndef
HAVE_STRNLEN" or similar.  Alternatively, just call it "xstrnlen" and
use it all the time.

- Josh Triplett


More information about the Xcb mailing list