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

Message ID 20260620053946.556799-4-sebastian.huber@embedded-brains.de
State New
Headers
Series Synchronize div() implementation with FreeBSD |

Commit Message

Sebastian Huber June 20, 2026, 5:39 a.m. UTC
  From: Aymeric Wibo <obiwac@FreeBSD.org>

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.
---
 newlib/libc/stdlib/div.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
  

Patch

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 */
 
 div_t
-div (int num,
-	int denom)
+div(int numer, int denom)
 {
 	div_t r;
 
-	r.quot = num / denom;
-	r.rem = num % denom;
+	r.quot = numer / denom;
+	r.rem = numer % denom;
 
 	return (r);
 }