[PATCH] Add implementation of strnlen for systems without this function

Yaakov (Cygwin/X) yselkowitz at users.sourceforge.net
Tue Oct 20 17:31:33 PDT 2009


On 20/10/2009 17:42, Jeremy Huddleston wrote:
> I'm not sure what magic to put in xlsclients.c to conditionally include 
> strnlen.h ... anybody want to chime in about that bit? This at least gets 
> it building with "warning: implicit declaration of function .strnlen."

Incremental patch attached.

> --- /dev/null
> +++ b/strnlen.h
[snip]
> +#ifndef __STRNLEN_H__
> +#define __STRNLEN_H__ 1
> +#include <stdlib.h>
> +
> +extern size_t strnlen(const char *s, size_t maxlen);
> +#endif __STRNLEN_H__
          ^^^^^^^^^^^^^
In file included from strnlen.c:31:
./strnlen.h:32:8: warning: extra tokens at end of #endif directive

The last line should be instead:

#endif /* __STRNLEN_H__ */


Yaakov
Cygwin/X




More information about the xorg-devel mailing list