[PATCH] Add strchrnul

Eric Blake eblake@redhat.com
Fri Apr 15 20:17:00 GMT 2011


On 03/27/2011 09:37 PM, Yaakov (Cygwin/X) wrote:
> I'm attaching a patch and new C file to implement strchrnul, a GNU
> extension.
> 
> Corinna: patch for winsup being posted to cygwin-patches.

> char *
> _DEFUN (strchrnul, (s1, i),
> 	_CONST char *s1 _AND
> 	int i)
> {
>   char *s = strchr(s1, i);
> 
>   if (*s != NULL)

Oops.  That's a SEGV waiting to happen.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/newlib/attachments/20110415/3591a1bb/attachment.sig>


More information about the Newlib mailing list