[PATCH v2 8/8] libc: Improve {,l,ll,imax}div(3) manpages

Sebastian Huber <[email protected]> Sat, 20 Jun 2026 11:52:10 +0200
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
From: Aymeric Wibo <[email protected]>

Mainly rename numerator parameter of div(3) and ldiv(3) from num to
numer, and explicitly specify what "numer", "denom", and "rem" mean in
the manpages.

MFC after:	3 days
Obtained from:	https://github.com/apple-oss-distributions/libc (partially=
)
Sponsored by:	Klara, Inc.

Signed-off-by: Sebastian Huber <[email protected]>
---
 newlib/libc/stdlib/div.c  | 7 +++----
 newlib/libc/stdlib/ldiv.c | 7 +++----
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/newlib/libc/stdlib/div.c b/newlib/libc/stdlib/div.c
index 467f25aa3..388c89425 100644
--- a/newlib/libc/stdlib/div.c
+++ b/newlib/libc/stdlib/div.c
@@ -79,13 +79,12 @@ No supporting OS subroutines are required.
 #include <stdlib.h>		/* div_t */
=20
 div_t
-div (int num,
-	int denom)
+div(int numer, int denom)
 {
 	div_t r;
=20
-	r.quot =3D num / denom;
-	r.rem =3D num % denom;
+	r.quot =3D numer / denom;
+	r.rem =3D numer % denom;
=20
 	return (r);
 }
diff --git a/newlib/libc/stdlib/ldiv.c b/newlib/libc/stdlib/ldiv.c
index 34052b6c9..dc9bc5d25 100644
--- a/newlib/libc/stdlib/ldiv.c
+++ b/newlib/libc/stdlib/ldiv.c
@@ -80,13 +80,12 @@ No supporting OS subroutines are required.
 #include <stdlib.h>		/* ldiv_t */
=20
 ldiv_t
-ldiv (long num,
-        long denom)
+ldiv(long numer, long denom)
 {
 	ldiv_t r;
=20
-	r.quot =3D num / denom;
-	r.rem =3D num % denom;
+	r.quot =3D numer / denom;
+	r.rem =3D numer % denom;
=20
 	return (r);
 }
--=20
2.51.0