svn commit: r221604 - head/usr.sbin/usbdump

Bruce Evans brde at optusnet.com.au
Sun May 8 09:50:18 UTC 2011


On Sat, 7 May 2011, Garrett Cooper wrote:

> On Sat, May 7, 2011 at 10:13 AM,  <mdf at freebsd.org> wrote:
>> On Sat, May 7, 2011 at 9:36 AM, Hans Petter Selasky <hselasky at c2i.net> wrote:
>>> On Saturday 07 May 2011 18:28:24 Hans Petter Selasky wrote:
>>>>   - Use memcpy() instead of bcopy().
>>>
>>> - Use memset() instead of bzero().
>>
>> Why?  It usually falls through to the same code in libc.  Is there
>> some standardization on memfoo versus bfoo here?

As part of adding lots of style bugs I suppose.

>    bfoo is marked legacy per POSIX 2001.1; example:
> http://pubs.opengroup.org/onlinepubs/009695399/functions/bcopy.html .

bfoo was correctly left out of POSIX.1-1988.  However, POSIX.1-2001 brought
back lots of historical cruft 13 years after POSIX.1-1988 deprecated it by
not having it at all.  However2, the bcopy family is not historical cruft
in BSD.

> A lot of folks (Linux leading the charge) are actively working to
> deprecate the APIs.

Another reason to not deprecate it in BSD :-).

bzero() is technically better than memset() since it doesn't waste
space or time for an extra arg.  bcmp() is technically better than
memcmp() for the usual case where you only want a binary result.  The
other bcopy functions are just different spellings of the newer
interfaces.

Bruce


More information about the svn-src-head mailing list