[Git][NTPsec/ntpsec][master] 2 commits: Cleanup a couple of sizeof text strings

Hal Murray (@hal.murray) gitlab at mg.gitlab.com
Sun Feb 2 11:19:25 UTC 2025



Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
63135b2f by Hal Murray at 2025-02-02T03:15:54-08:00
Cleanup a couple of sizeof text strings

- - - - -
889138ca by Hal Murray at 2025-02-02T03:17:35-08:00
More work on cross long long

- - - - -


2 changed files:

- ntpd/ntp_control.c
- wafhelpers/check_sizeof.py


Changes:

=====================================
ntpd/ntp_control.c
=====================================
@@ -197,7 +197,11 @@ struct var {
     const unsigned long int* uli;
     const long int* li;
     const long long* ll;
-    const int64_t* timex_li;
+#ifdef NTP_TIMEX_LONG_LONG
+    const long long* timex_li;
+#else
+    const long* timex_li;
+#endif
     const unsigned int* uinnt;
     const int* innt;
     const uint64_t* u64;
@@ -280,14 +284,8 @@ struct var {
 
 #define Var_mrumem(xname, xflags, xlocation) { \
   .name = xname, .flags = xflags, .type = v_mrumem, .p.u64 = &xlocation }
-#ifdef NTP_TIMEX_LONG_LONG
-  DING DING DING:  We got here.  Tell Hal
 #define Var_kli(xname, xflags, xlocation) { \
-  .name = xname, .flags = xflags, .type = v_kli, .p.ll = &xlocation }
-#else
-#define Var_kli(xname, xflags, xlocation) { \
-  .name = xname, .flags = xflags, .type = v_kli, .p.li = &xlocation }
-#endif
+  .name = xname, .flags = xflags, .type = v_kli, .p.timex_li = &xlocation }
 #define Var_special(xname, xflags, xspecial) { \
   .name = xname, .flags = xflags, .type = v_special, .p.special = xspecial }
 
@@ -1450,9 +1448,9 @@ ctl_putsys(const struct var * v) {
 	case v_kli:
 	    if (v->flags&K_16) {
 		/* value is scaled by 16 bits */
-		temp_d = FP_UNSCALE(*v->p.li);
+		temp_d = FP_UNSCALE(*v->p.timex_li);
 	    } else {
-		temp_d = (double)*v->p.li;
+		temp_d = (double)*v->p.timex_li;
 	    };
 	    if (v->flags & (KNUToMS | KUToMS)) {
 		/* value is in nanoseconds or microseconds */


=====================================
wafhelpers/check_sizeof.py
=====================================
@@ -109,7 +109,7 @@ int main(void) {
 
 def check_timex(ctx):
     name = "NTP_TIMEX_LONG_LONG"
-    ctx.start_msg("Checking sizeof struct timex slot")
+    ctx.start_msg("Checking for long long in struct timex" )
     ctx.check_cc(
         cflags="-Werror",
         fragment=SIZE_FRAG_TIMEX,
@@ -118,7 +118,7 @@ def check_timex(ctx):
         define_ret=True,
         quote=False,
         mandatory=False,
-        comment="Does struct timex use long long"
+        comment="struct timex has long long"
     )
     ctx.end_msg(ctx.get_define(name))
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/compare/71883900e207ad93c82a15908befbb104ecc6c17...889138ca3952e64ecef830e03e88f890a49df466

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/compare/71883900e207ad93c82a15908befbb104ecc6c17...889138ca3952e64ecef830e03e88f890a49df466
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20250202/fd3612fe/attachment-0001.htm>


More information about the vc mailing list