[Git][NTPsec/ntpsec][master] Boolification: dofptoa() and dolfptoa().

Eric S. Raymond gitlab at mg.gitlab.com
Sun Nov 29 23:18:47 UTC 2015


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
9da2eff0 by Eric S. Raymond at 2015-11-29T18:17:37Z
Boolification: dofptoa() and dolfptoa().

- - - - -


3 changed files:

- include/ntp_fp.h
- libntp/dofptoa.c
- libntp/dolfptoa.c


Changes:

=====================================
include/ntp_fp.h
=====================================
--- a/include/ntp_fp.h
+++ b/include/ntp_fp.h
@@ -335,8 +335,8 @@ typedef uint32_t u_fp;
 /*
  * Prototypes
  */
-extern	char *	dofptoa		(u_fp, int, short, int);
-extern	char *	dolfptoa	(uint32_t, uint32_t, int, short, int);
+extern	char *	dofptoa		(u_fp, bool, short, bool);
+extern	char *	dolfptoa	(uint32_t, uint32_t, bool, short, bool);
 
 extern	bool	atolfp		(const char *, l_fp *);
 extern	char *	fptoa		(s_fp, short);
@@ -368,8 +368,8 @@ extern	struct tm * ntp2unix_tm (uint32_t ntp, int local);
 #define sptoa(addr)		sockporttoa(addr)
 #define stohost(addr)		socktohost(addr)
 
-#define	ufptoa(fpv, ndec)	dofptoa((fpv), 0, (ndec), 0)
-#define	ufptoms(fpv, ndec)	dofptoa((fpv), 0, (ndec), 1)
+#define	ufptoa(fpv, ndec)	dofptoa((fpv), false, (ndec), false)
+#define	ufptoms(fpv, ndec)	dofptoa((fpv), false, (ndec), true)
 #define	ulfptoa(fpv, ndec)	dolfptoa((fpv)->l_ui, (fpv)->l_uf, 0, (ndec), 0)
 #define	ulfptoms(fpv, ndec)	dolfptoa((fpv)->l_ui, (fpv)->l_uf, 0, (ndec), 1)
 #define	umfptoa(fpi, fpf, ndec) dolfptoa((fpi), (fpf), 0, (ndec), 0)


=====================================
libntp/dofptoa.c
=====================================
--- a/libntp/dofptoa.c
+++ b/libntp/dofptoa.c
@@ -12,9 +12,9 @@
 char *
 dofptoa(
 	u_fp fpv,
-	int neg,
+	bool neg,
 	short ndec,
-	int msec
+	bool msec
 	)
 {
 	register uint8_t *cp, *cpend;
@@ -126,16 +126,16 @@ fptoa(
 	)
 {
 	u_fp	plusfp;
-	int	neg;
+	bool	isneg;
 
-	neg = (fpv < 0);
-	if (neg) {
+	isneg = (fpv < 0);
+	if (isneg) {
 		plusfp = (u_fp)(-fpv);
 	} else {
 		plusfp = (u_fp)fpv;
 	}
 
-	return dofptoa(plusfp, neg, ndec, false);
+	return dofptoa(plusfp, isneg, ndec, false);
 }
 
 
@@ -146,14 +146,14 @@ fptoms(
 	)
 {
 	u_fp	plusfp;
-	int	neg;
+	bool	isneg;
 
-	neg = (fpv < 0);
-	if (neg) {
+	isneg = (fpv < 0);
+	if (isneg) {
 		plusfp = (u_fp)(-fpv);
 	} else {
 		plusfp = (u_fp)fpv;
 	}
 
-	return dofptoa(plusfp, neg, ndec, true);
+	return dofptoa(plusfp, isneg, ndec, true);
 }


=====================================
libntp/dolfptoa.c
=====================================
--- a/libntp/dolfptoa.c
+++ b/libntp/dolfptoa.c
@@ -13,9 +13,9 @@ char *
 dolfptoa(
 	uint32_t fpi,
 	uint32_t fpv,
-	int neg,
+	bool neg,
 	short ndec,
-	int msec
+	bool msec
 	)
 {
 	uint8_t *cp, *cpend, *cpdec;
@@ -143,7 +143,7 @@ mfptoa(
 	short	ndec
 	)
 {
-	int	isneg;
+	bool	isneg;
 
 	isneg = M_ISNEG(fpi);
 	if (isneg) {
@@ -161,7 +161,7 @@ mfptoms(
 	short	ndec
 	)
 {
-	int	isneg;
+	bool	isneg;
 
 	isneg = M_ISNEG(fpi);
 	if (isneg) {



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/9da2eff0ba84774de3379a26aa8d26c7a8c4c3bd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20151129/cd3df488/attachment.html>


More information about the vc mailing list