[Git][NTPsec/ntpsec][master] Clean up return type from atof and use 'bool' where possible.

Eric S. Raymond gitlab at mg.gitlab.com
Sun Jul 17 11:30:00 UTC 2016


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


Commits:
17262a07 by Matt Selsky at 2016-07-17T07:29:52-04:00
Clean up return type from atof and use 'bool' where possible.

- - - - -


1 changed file:

- util/propdelay.c


Changes:

=====================================
util/propdelay.c
=====================================
--- a/util/propdelay.c
+++ b/util/propdelay.c
@@ -47,22 +47,16 @@
  * to find delays to GOES via each of the three satellites.
  */
 
-#include <config.h>
+#include "config.h"
 
+#include <stdbool.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
+#include <math.h>
 
 #include "ntp_stdlib.h"
 
-extern	double	sin	(double);
-extern	double	cos	(double);
-extern	double	acos	(double);
-extern	double	tan	(double);
-extern	double	atan	(double);
-extern	double	sqrt	(double);
-
-#define	STREQ(a, b)	(*(a) == *(b) && strcmp((a), (b)) == 0)
-
 /*
  * Program constants
  */
@@ -110,11 +104,11 @@ char *goes_stby_long = GOES_STBY_LONG;
 char *goes_west_long = GOES_WEST_LONG;
 char *goes_sat_lat = GOES_SAT_LAT;
 
-int hflag = 0;
-int Wflag = 0;
-int Cflag = 0;
-int Gflag = 0;
-int height;
+bool hflag = false;
+bool Wflag = false;
+bool Cflag = false;
+bool Gflag = false;
+double height;
 
 char *progname;
 
@@ -138,7 +132,7 @@ main(
 	)
 {
 	int c;
-	int errflg = 0;
+	bool errflg = false;
 	double lat1, long1;
 	double lat2, long2;
 	double lat3, long3;
@@ -152,25 +146,25 @@ main(
 		    ++debug;
 		    break;
 		case 'h':
-		    hflag++;
+		    hflag = true;
 		    height = atof(ntp_optarg);
 		    if (height <= 0.0) {
 			    (void) fprintf(stderr, "height %s unlikely\n",
 					   ntp_optarg);
-			    errflg++;
+			    errflg = true;
 		    }
 		    break;
 		case 'C':
-		    Cflag++;
+		    Cflag = true;
 		    break;
 		case 'W':
-		    Wflag++;
+		    Wflag = true;
 		    break;
 		case 'G':
-		    Gflag++;
+		    Gflag = true;
 		    break;
 		default:
-		    errflg++;
+		    errflg = true;
 		    break;
 	    }
 	if (errflg || (!(Cflag || Wflag || Gflag) && ntp_optind+4 != argc) || 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/17262a07ce0c0fdac58b2e2d9e1776bb2783fd87
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160717/c181ccf1/attachment.html>


More information about the vc mailing list