Date: Sat, 22 Nov 2025 16:16:33 +0000 From: Jose Luis Duran <jlduran@FreeBSD.org> To: doc-committers@FreeBSD.org, dev-commits-doc-all@FreeBSD.org Subject: git: 0ecd8c6ee2 - main - handbook/sockets: Update a stray bzero() comment Message-ID: <6921e1e1.3a20c.12f6fe92@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by jlduran: URL: https://cgit.FreeBSD.org/doc/commit/?id=0ecd8c6ee2da3192e0aec89bc049011b6f1c575c commit 0ecd8c6ee2da3192e0aec89bc049011b6f1c575c Author: Jose Luis Duran <jlduran@FreeBSD.org> AuthorDate: 2025-10-30 18:00:46 +0000 Commit: Jose Luis Duran <jlduran@FreeBSD.org> CommitDate: 2025-11-22 16:09:57 +0000 handbook/sockets: Update a stray bzero() comment The example was changed to use memset() instead of bzero(). Update the text accordingly. Reviewed by: ziaee Fixes: 920aa82eb1 ("sockets(examples): remove unused register, replace bzero with memset") Pull Request: https://github.com/freebsd/freebsd-doc/pull/563 --- documentation/content/en/books/developers-handbook/sockets/_index.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/content/en/books/developers-handbook/sockets/_index.adoc b/documentation/content/en/books/developers-handbook/sockets/_index.adoc index a85deb7394..95c8b7b814 100644 --- a/documentation/content/en/books/developers-handbook/sockets/_index.adoc +++ b/documentation/content/en/books/developers-handbook/sockets/_index.adoc @@ -799,7 +799,7 @@ if (INADDR_ANY) .... Its value is `0`. -Since we have just used `bzero` on the entire structure, it would be redundant to set it to `0` again. +Since we have just used `memset` to set zeroes on the entire structure, it would be redundant to set it to `0` again. But if we port our code to some other system where INADDR_ANY is perhaps not a zero, we need to assign it to `sa.sin_addr.s_addr`. Most modern C compilers are clever enough to notice that INADDR_ANY is a constant. As long as it is a zero, they will optimize the entire conditional statement out of the code.help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6921e1e1.3a20c.12f6fe92>
