bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: xstring.h


From: Eric Blake
Subject: Re: xstring.h
Date: Fri, 09 May 2008 22:51:10 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080421 Thunderbird/2.0.0.14 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Bruno Haible on 5/9/2008 8:20 PM:
| strndup is a glibc (not POSIX) function.

Not for long.  It is on the list of functions being added in Posix 200x.

| I find the semantics of strndup,
| strnlen, and strncmp always hard to remember.

Particularly when competing against stpcpy and strlcpy.

| This complexity is not needed
| here: When you are extracting a substring, you already know that the string
| does not end before (str + len).

Good point.  Therefore, a substring function can be more efficient than
strndup.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkglKb0ACgkQ84KuGfSFAYCw8wCgkArzVtQRCEH/88Y+OL2gd8sz
/I8An2Y1R/iNMoL2PabFyaHV3jBDtSWQ
=rPnX
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]