[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Rename probability distribution names to end with "_t".



commit 31a6a6512fa1a85ef5ea5cb37f0a7aec080d5848
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Thu Nov 7 08:55:23 2019 -0500

    Rename probability distribution names to end with "_t".
    
    I needed to do this by hand, since we also use these for function
    names, variable names, macro expansion, and a little token pasting.
---
 src/core/or/circuitpadding.c |  12 ++--
 src/lib/math/prob_distr.c    | 140 ++++++++++++++++++++++---------------------
 src/lib/math/prob_distr.h    |  68 ++++++++++-----------
 src/test/test_prob_distr.c   |  30 +++++-----
 4 files changed, 127 insertions(+), 123 deletions(-)

diff --git a/src/core/or/circuitpadding.c b/src/core/or/circuitpadding.c
index e9b14144c..3853e9fdc 100644
--- a/src/core/or/circuitpadding.c
+++ b/src/core/or/circuitpadding.c
@@ -688,7 +688,7 @@ circpad_distribution_sample(circpad_distribution_t dist)
     case CIRCPAD_DIST_UNIFORM:
       {
         // param2 is upper bound, param1 is lower
-        const struct uniform my_uniform = {
+        const struct uniform_t my_uniform = {
           .base = UNIFORM(my_uniform),
           .a = dist.param1,
           .b = dist.param2,
@@ -698,7 +698,7 @@ circpad_distribution_sample(circpad_distribution_t dist)
     case CIRCPAD_DIST_LOGISTIC:
       {
       /* param1 is Mu, param2 is sigma. */
-        const struct logistic my_logistic = {
+        const struct logistic_t my_logistic = {
           .base = LOGISTIC(my_logistic),
           .mu = dist.param1,
           .sigma = dist.param2,
@@ -708,7 +708,7 @@ circpad_distribution_sample(circpad_distribution_t dist)
     case CIRCPAD_DIST_LOG_LOGISTIC:
       {
         /* param1 is Alpha, param2 is 1.0/Beta */
-        const struct log_logistic my_log_logistic = {
+        const struct log_logistic_t my_log_logistic = {
           .base = LOG_LOGISTIC(my_log_logistic),
           .alpha = dist.param1,
           .beta = dist.param2,
@@ -718,7 +718,7 @@ circpad_distribution_sample(circpad_distribution_t dist)
     case CIRCPAD_DIST_GEOMETRIC:
       {
         /* param1 is 'p' (success probability) */
-        const struct geometric my_geometric = {
+        const struct geometric_t my_geometric = {
           .base = GEOMETRIC(my_geometric),
           .p = dist.param1,
         };
@@ -727,7 +727,7 @@ circpad_distribution_sample(circpad_distribution_t dist)
     case CIRCPAD_DIST_WEIBULL:
       {
         /* param1 is k, param2 is Lambda */
-        const struct weibull my_weibull = {
+        const struct weibull_t my_weibull = {
           .base = WEIBULL(my_weibull),
           .k = dist.param1,
           .lambda = dist.param2,
@@ -737,7 +737,7 @@ circpad_distribution_sample(circpad_distribution_t dist)
     case CIRCPAD_DIST_PARETO:
       {
         /* param1 is sigma, param2 is xi, no more params for mu so we use 0 */
-        const struct genpareto my_genpareto = {
+        const struct genpareto_t my_genpareto = {
           .base = GENPARETO(my_genpareto),
           .mu = 0,
           .sigma = dist.param1,
diff --git a/src/lib/math/prob_distr.c b/src/lib/math/prob_distr.c
index 757cd9bdd..1d1748666 100644
--- a/src/lib/math/prob_distr.c
+++ b/src/lib/math/prob_distr.c
@@ -52,14 +52,15 @@
 #include <math.h>
 #include <stddef.h>
 
+#ifndef COCCI
 /** Declare a function that downcasts from a generic dist struct to the actual
  *  subtype probablity distribution it represents. */
 #define DECLARE_PROB_DISTR_DOWNCAST_FN(name) \
   static inline                           \
-  const struct name *                             \
-  dist_to_const_##name(const struct dist *obj) {    \
+  const struct name##_t *                             \
+  dist_to_const_##name(const struct dist_t *obj) {    \
     tor_assert(obj->ops == &name##_ops);            \
-    return SUBTYPE_P(obj, struct name, base);   \
+    return SUBTYPE_P(obj, struct name ## _t, base);   \
   }
 DECLARE_PROB_DISTR_DOWNCAST_FN(uniform)
 DECLARE_PROB_DISTR_DOWNCAST_FN(geometric)
@@ -67,6 +68,7 @@ DECLARE_PROB_DISTR_DOWNCAST_FN(logistic)
 DECLARE_PROB_DISTR_DOWNCAST_FN(log_logistic)
 DECLARE_PROB_DISTR_DOWNCAST_FN(genpareto)
 DECLARE_PROB_DISTR_DOWNCAST_FN(weibull)
+#endif
 
 /**
  * Count number of one bits in 32-bit word.
@@ -1324,42 +1326,42 @@ sample_geometric(uint32_t s, double p0, double p)
 
 /** Returns the name of the distribution in <b>dist</b>. */
 const char *
-dist_name(const struct dist *dist)
+dist_name(const struct dist_t *dist)
 {
   return dist->ops->name;
 }
 
 /* Sample a value from <b>dist</b> and return it. */
 double
-dist_sample(const struct dist *dist)
+dist_sample(const struct dist_t *dist)
 {
   return dist->ops->sample(dist);
 }
 
 /** Compute the CDF of <b>dist</b> at <b>x</b>. */
 double
-dist_cdf(const struct dist *dist, double x)
+dist_cdf(const struct dist_t *dist, double x)
 {
   return dist->ops->cdf(dist, x);
 }
 
 /** Compute the SF (Survival function) of <b>dist</b> at <b>x</b>. */
 double
-dist_sf(const struct dist *dist, double x)
+dist_sf(const struct dist_t *dist, double x)
 {
   return dist->ops->sf(dist, x);
 }
 
 /** Compute the iCDF (Inverse CDF) of <b>dist</b> at <b>x</b>. */
 double
-dist_icdf(const struct dist *dist, double p)
+dist_icdf(const struct dist_t *dist, double p)
 {
   return dist->ops->icdf(dist, p);
 }
 
 /** Compute the iSF (Inverse Survival function) of <b>dist</b> at <b>x</b>. */
 double
-dist_isf(const struct dist *dist, double p)
+dist_isf(const struct dist_t *dist, double p)
 {
   return dist->ops->isf(dist, p);
 }
@@ -1367,18 +1369,18 @@ dist_isf(const struct dist *dist, double p)
 /** Functions for uniform distribution */
 
 static double
-uniform_sample(const struct dist *dist)
+uniform_sample(const struct dist_t *dist)
 {
-  const struct uniform *U = dist_to_const_uniform(dist);
+  const struct uniform_t *U = dist_to_const_uniform(dist);
   double p0 = random_uniform_01();
 
   return sample_uniform_interval(p0, U->a, U->b);
 }
 
 static double
-uniform_cdf(const struct dist *dist, double x)
+uniform_cdf(const struct dist_t *dist, double x)
 {
-  const struct uniform *U = dist_to_const_uniform(dist);
+  const struct uniform_t *U = dist_to_const_uniform(dist);
   if (x < U->a)
     return 0;
   else if (x < U->b)
@@ -1388,9 +1390,9 @@ uniform_cdf(const struct dist *dist, double x)
 }
 
 static double
-uniform_sf(const struct dist *dist, double x)
+uniform_sf(const struct dist_t *dist, double x)
 {
-  const struct uniform *U = dist_to_const_uniform(dist);
+  const struct uniform_t *U = dist_to_const_uniform(dist);
 
   if (x > U->b)
     return 0;
@@ -1401,18 +1403,18 @@ uniform_sf(const struct dist *dist, double x)
 }
 
 static double
-uniform_icdf(const struct dist *dist, double p)
+uniform_icdf(const struct dist_t *dist, double p)
 {
-  const struct uniform *U = dist_to_const_uniform(dist);
+  const struct uniform_t *U = dist_to_const_uniform(dist);
   double w = U->b - U->a;
 
   return (p < 0.5 ? (U->a + w*p) : (U->b - w*(1 - p)));
 }
 
 static double
-uniform_isf(const struct dist *dist, double p)
+uniform_isf(const struct dist_t *dist, double p)
 {
-  const struct uniform *U = dist_to_const_uniform(dist);
+  const struct uniform_t *U = dist_to_const_uniform(dist);
   double w = U->b - U->a;
 
   return (p < 0.5 ? (U->b - w*p) : (U->a + w*(1 - p)));
@@ -1434,9 +1436,9 @@ const struct dist_ops_t uniform_ops = {
 /** Functions for logistic distribution: */
 
 static double
-logistic_sample(const struct dist *dist)
+logistic_sample(const struct dist_t *dist)
 {
-  const struct logistic *L = dist_to_const_logistic(dist);
+  const struct logistic_t *L = dist_to_const_logistic(dist);
   uint32_t s = crypto_fast_rng_get_u32(get_thread_fast_rng());
   double t = random_uniform_01();
   double p0 = random_uniform_01();
@@ -1445,30 +1447,30 @@ logistic_sample(const struct dist *dist)
 }
 
 static double
-logistic_cdf(const struct dist *dist, double x)
+logistic_cdf(const struct dist_t *dist, double x)
 {
-  const struct logistic *L = dist_to_const_logistic(dist);
+  const struct logistic_t *L = dist_to_const_logistic(dist);
   return cdf_logistic(x, L->mu, L->sigma);
 }
 
 static double
-logistic_sf(const struct dist *dist, double x)
+logistic_sf(const struct dist_t *dist, double x)
 {
-  const struct logistic *L = dist_to_const_logistic(dist);
+  const struct logistic_t *L = dist_to_const_logistic(dist);
   return sf_logistic(x, L->mu, L->sigma);
 }
 
 static double
-logistic_icdf(const struct dist *dist, double p)
+logistic_icdf(const struct dist_t *dist, double p)
 {
-  const struct logistic *L = dist_to_const_logistic(dist);
+  const struct logistic_t *L = dist_to_const_logistic(dist);
   return icdf_logistic(p, L->mu, L->sigma);
 }
 
 static double
-logistic_isf(const struct dist *dist, double p)
+logistic_isf(const struct dist_t *dist, double p)
 {
-  const struct logistic *L = dist_to_const_logistic(dist);
+  const struct logistic_t *L = dist_to_const_logistic(dist);
   return isf_logistic(p, L->mu, L->sigma);
 }
 
@@ -1484,9 +1486,9 @@ const struct dist_ops_t logistic_ops = {
 /** Functions for log-logistic distribution: */
 
 static double
-log_logistic_sample(const struct dist *dist)
+log_logistic_sample(const struct dist_t *dist)
 {
-  const struct log_logistic *LL = dist_to_const_log_logistic(dist);
+  const struct log_logistic_t *LL = dist_to_const_log_logistic(dist);
   uint32_t s = crypto_fast_rng_get_u32(get_thread_fast_rng());
   double p0 = random_uniform_01();
 
@@ -1494,30 +1496,30 @@ log_logistic_sample(const struct dist *dist)
 }
 
 static double
-log_logistic_cdf(const struct dist *dist, double x)
+log_logistic_cdf(const struct dist_t *dist, double x)
 {
-  const struct log_logistic *LL = dist_to_const_log_logistic(dist);
+  const struct log_logistic_t *LL = dist_to_const_log_logistic(dist);
   return cdf_log_logistic(x, LL->alpha, LL->beta);
 }
 
 static double
-log_logistic_sf(const struct dist *dist, double x)
+log_logistic_sf(const struct dist_t *dist, double x)
 {
-  const struct log_logistic *LL = dist_to_const_log_logistic(dist);
+  const struct log_logistic_t *LL = dist_to_const_log_logistic(dist);
   return sf_log_logistic(x, LL->alpha, LL->beta);
 }
 
 static double
-log_logistic_icdf(const struct dist *dist, double p)
+log_logistic_icdf(const struct dist_t *dist, double p)
 {
-  const struct log_logistic *LL = dist_to_const_log_logistic(dist);
+  const struct log_logistic_t *LL = dist_to_const_log_logistic(dist);
   return icdf_log_logistic(p, LL->alpha, LL->beta);
 }
 
 static double
-log_logistic_isf(const struct dist *dist, double p)
+log_logistic_isf(const struct dist_t *dist, double p)
 {
-  const struct log_logistic *LL = dist_to_const_log_logistic(dist);
+  const struct log_logistic_t *LL = dist_to_const_log_logistic(dist);
   return isf_log_logistic(p, LL->alpha, LL->beta);
 }
 
@@ -1533,9 +1535,9 @@ const struct dist_ops_t log_logistic_ops = {
 /** Functions for Weibull distribution */
 
 static double
-weibull_sample(const struct dist *dist)
+weibull_sample(const struct dist_t *dist)
 {
-  const struct weibull *W = dist_to_const_weibull(dist);
+  const struct weibull_t *W = dist_to_const_weibull(dist);
   uint32_t s = crypto_fast_rng_get_u32(get_thread_fast_rng());
   double p0 = random_uniform_01();
 
@@ -1543,30 +1545,30 @@ weibull_sample(const struct dist *dist)
 }
 
 static double
-weibull_cdf(const struct dist *dist, double x)
+weibull_cdf(const struct dist_t *dist, double x)
 {
-  const struct weibull *W = dist_to_const_weibull(dist);
+  const struct weibull_t *W = dist_to_const_weibull(dist);
   return cdf_weibull(x, W->lambda, W->k);
 }
 
 static double
-weibull_sf(const struct dist *dist, double x)
+weibull_sf(const struct dist_t *dist, double x)
 {
-  const struct weibull *W = dist_to_const_weibull(dist);
+  const struct weibull_t *W = dist_to_const_weibull(dist);
   return sf_weibull(x, W->lambda, W->k);
 }
 
 static double
-weibull_icdf(const struct dist *dist, double p)
+weibull_icdf(const struct dist_t *dist, double p)
 {
-  const struct weibull *W = dist_to_const_weibull(dist);
+  const struct weibull_t *W = dist_to_const_weibull(dist);
   return icdf_weibull(p, W->lambda, W->k);
 }
 
 static double
-weibull_isf(const struct dist *dist, double p)
+weibull_isf(const struct dist_t *dist, double p)
 {
-  const struct weibull *W = dist_to_const_weibull(dist);
+  const struct weibull_t *W = dist_to_const_weibull(dist);
   return isf_weibull(p, W->lambda, W->k);
 }
 
@@ -1582,9 +1584,9 @@ const struct dist_ops_t weibull_ops = {
 /** Functions for generalized Pareto distributions */
 
 static double
-genpareto_sample(const struct dist *dist)
+genpareto_sample(const struct dist_t *dist)
 {
-  const struct genpareto *GP = dist_to_const_genpareto(dist);
+  const struct genpareto_t *GP = dist_to_const_genpareto(dist);
   uint32_t s = crypto_fast_rng_get_u32(get_thread_fast_rng());
   double p0 = random_uniform_01();
 
@@ -1592,30 +1594,30 @@ genpareto_sample(const struct dist *dist)
 }
 
 static double
-genpareto_cdf(const struct dist *dist, double x)
+genpareto_cdf(const struct dist_t *dist, double x)
 {
-  const struct genpareto *GP = dist_to_const_genpareto(dist);
+  const struct genpareto_t *GP = dist_to_const_genpareto(dist);
   return cdf_genpareto(x, GP->mu, GP->sigma, GP->xi);
 }
 
 static double
-genpareto_sf(const struct dist *dist, double x)
+genpareto_sf(const struct dist_t *dist, double x)
 {
-  const struct genpareto *GP = dist_to_const_genpareto(dist);
+  const struct genpareto_t *GP = dist_to_const_genpareto(dist);
   return sf_genpareto(x, GP->mu, GP->sigma, GP->xi);
 }
 
 static double
-genpareto_icdf(const struct dist *dist, double p)
+genpareto_icdf(const struct dist_t *dist, double p)
 {
-  const struct genpareto *GP = dist_to_const_genpareto(dist);
+  const struct genpareto_t *GP = dist_to_const_genpareto(dist);
   return icdf_genpareto(p, GP->mu, GP->sigma, GP->xi);
 }
 
 static double
-genpareto_isf(const struct dist *dist, double p)
+genpareto_isf(const struct dist_t *dist, double p)
 {
-  const struct genpareto *GP = dist_to_const_genpareto(dist);
+  const struct genpareto_t *GP = dist_to_const_genpareto(dist);
   return isf_genpareto(p, GP->mu, GP->sigma, GP->xi);
 }
 
@@ -1631,9 +1633,9 @@ const struct dist_ops_t genpareto_ops = {
 /** Functions for geometric distribution on number of trials before success */
 
 static double
-geometric_sample(const struct dist *dist)
+geometric_sample(const struct dist_t *dist)
 {
-  const struct geometric *G = dist_to_const_geometric(dist);
+  const struct geometric_t *G = dist_to_const_geometric(dist);
   uint32_t s = crypto_fast_rng_get_u32(get_thread_fast_rng());
   double p0 = random_uniform_01();
 
@@ -1641,9 +1643,9 @@ geometric_sample(const struct dist *dist)
 }
 
 static double
-geometric_cdf(const struct dist *dist, double x)
+geometric_cdf(const struct dist_t *dist, double x)
 {
-  const struct geometric *G = dist_to_const_geometric(dist);
+  const struct geometric_t *G = dist_to_const_geometric(dist);
 
   if (x < 1)
     return 0;
@@ -1652,9 +1654,9 @@ geometric_cdf(const struct dist *dist, double x)
 }
 
 static double
-geometric_sf(const struct dist *dist, double x)
+geometric_sf(const struct dist_t *dist, double x)
 {
-  const struct geometric *G = dist_to_const_geometric(dist);
+  const struct geometric_t *G = dist_to_const_geometric(dist);
 
   if (x < 1)
     return 0;
@@ -1663,17 +1665,17 @@ geometric_sf(const struct dist *dist, double x)
 }
 
 static double
-geometric_icdf(const struct dist *dist, double p)
+geometric_icdf(const struct dist_t *dist, double p)
 {
-  const struct geometric *G = dist_to_const_geometric(dist);
+  const struct geometric_t *G = dist_to_const_geometric(dist);
 
   return log1p(-p)/log1p(-G->p);
 }
 
 static double
-geometric_isf(const struct dist *dist, double p)
+geometric_isf(const struct dist_t *dist, double p)
 {
-  const struct geometric *G = dist_to_const_geometric(dist);
+  const struct geometric_t *G = dist_to_const_geometric(dist);
 
   return log(p)/log1p(-G->p);
 }
diff --git a/src/lib/math/prob_distr.h b/src/lib/math/prob_distr.h
index f47bf09c5..4498b0a8b 100644
--- a/src/lib/math/prob_distr.h
+++ b/src/lib/math/prob_distr.h
@@ -15,12 +15,12 @@
 /**
  * Container for distribution parameters for sampling, CDF, &c.
  */
-struct dist {
+struct dist_t {
   const struct dist_ops_t *ops;
 };
 
 /**
- * Untyped initializer element for struct dist using the specified
+ * Untyped initializer element for struct dist_t using the specified
  * struct dist_ops_t pointer.  Don't actually use this directly -- use
  * the type-specific macro built out of DIST_BASE_TYPED below -- but if
  * you did use this directly, it would be something like:
@@ -61,13 +61,13 @@ struct dist {
 #endif /* defined(__COVERITY__) */
 
 /**
-* Typed initializer element for struct dist using the specified struct
+* Typed initializer element for struct dist_t using the specified struct
 * dist_ops_t pointer.  Don't actually use this directly -- use a
 * type-specific macro built out of it -- but if you did use this
 * directly, it would be something like:
 *
 *     struct weibull mydist = {
-*       DIST_BASE_TYPED(&weibull_ops, mydist, struct weibull),
+*       DIST_BASE_TYPED(&weibull_ops, mydist, struct weibull_t),
 *       .lambda = ...,
 *       .k = ...,
 *     };
@@ -76,7 +76,7 @@ struct dist {
 * operations and define a type-specific initializer element like so:
 *
 *     struct foo {
-*       struct dist base;
+*       struct dist_t base;
 *       int omega;
 *       double tau;
 *       double phi;
@@ -113,12 +113,12 @@ struct dist {
  * corresponding dist_ops_t function.  In the parlance of C++, these call
  * virtual member functions.
  */
-const char *dist_name(const struct dist *);
-double dist_sample(const struct dist *);
-double dist_cdf(const struct dist *, double x);
-double dist_sf(const struct dist *, double x);
-double dist_icdf(const struct dist *, double p);
-double dist_isf(const struct dist *, double p);
+const char *dist_name(const struct dist_t *);
+double dist_sample(const struct dist_t *);
+double dist_cdf(const struct dist_t *, double x);
+double dist_sf(const struct dist_t *, double x);
+double dist_icdf(const struct dist_t *, double p);
+double dist_isf(const struct dist_t *, double p);
 
 /**
  * Set of operations on a potentially parametric family of
@@ -127,29 +127,29 @@ double dist_isf(const struct dist *, double p);
  */
 struct dist_ops_t {
   const char *name;
-  double (*sample)(const struct dist *);
-  double (*cdf)(const struct dist *, double x);
-  double (*sf)(const struct dist *, double x);
-  double (*icdf)(const struct dist *, double p);
-  double (*isf)(const struct dist *, double p);
+  double (*sample)(const struct dist_t *);
+  double (*cdf)(const struct dist_t *, double x);
+  double (*sf)(const struct dist_t *, double x);
+  double (*icdf)(const struct dist_t *, double p);
+  double (*isf)(const struct dist_t *, double p);
 };
 
 /* Geometric distribution on positive number of trials before first success */
 
-struct geometric {
-  struct dist base;
+struct geometric_t {
+  struct dist_t base;
   double p; /* success probability */
 };
 
 extern const struct dist_ops_t geometric_ops;
 
 #define GEOMETRIC(OBJ)                                      \
-  DIST_BASE_TYPED(&geometric_ops, OBJ, struct geometric)
+  DIST_BASE_TYPED(&geometric_ops, OBJ, struct geometric_t)
 
 /* Pareto distribution */
 
-struct genpareto {
-  struct dist base;
+struct genpareto_t {
+  struct dist_t base;
   double mu;
   double sigma;
   double xi;
@@ -158,12 +158,12 @@ struct genpareto {
 extern const struct dist_ops_t genpareto_ops;
 
 #define GENPARETO(OBJ)                                      \
-  DIST_BASE_TYPED(&genpareto_ops, OBJ, struct genpareto)
+  DIST_BASE_TYPED(&genpareto_ops, OBJ, struct genpareto_t)
 
 /* Weibull distribution */
 
-struct weibull {
-  struct dist base;
+struct weibull_t {
+  struct dist_t base;
   double lambda;
   double k;
 };
@@ -171,12 +171,12 @@ struct weibull {
 extern const struct dist_ops_t weibull_ops;
 
 #define WEIBULL(OBJ)                                    \
-  DIST_BASE_TYPED(&weibull_ops, OBJ, struct weibull)
+  DIST_BASE_TYPED(&weibull_ops, OBJ, struct weibull_t)
 
 /* Log-logistic distribution */
 
-struct log_logistic {
-  struct dist base;
+struct log_logistic_t {
+  struct dist_t base;
   double alpha;
   double beta;
 };
@@ -184,12 +184,12 @@ struct log_logistic {
 extern const struct dist_ops_t log_logistic_ops;
 
 #define LOG_LOGISTIC(OBJ)                                       \
-  DIST_BASE_TYPED(&log_logistic_ops, OBJ, struct log_logistic)
+  DIST_BASE_TYPED(&log_logistic_ops, OBJ, struct log_logistic_t)
 
 /* Logistic distribution */
 
-struct logistic {
-  struct dist base;
+struct logistic_t {
+  struct dist_t base;
   double mu;
   double sigma;
 };
@@ -197,12 +197,12 @@ struct logistic {
 extern const struct dist_ops_t logistic_ops;
 
 #define LOGISTIC(OBJ)                                   \
-  DIST_BASE_TYPED(&logistic_ops, OBJ, struct logistic)
+  DIST_BASE_TYPED(&logistic_ops, OBJ, struct logistic_t)
 
 /* Uniform distribution */
 
-struct uniform {
-  struct dist base;
+struct uniform_t {
+  struct dist_t base;
   double a;
   double b;
 };
@@ -210,7 +210,7 @@ struct uniform {
 extern const struct dist_ops_t uniform_ops;
 
 #define UNIFORM(OBJ)                                    \
-  DIST_BASE_TYPED(&uniform_ops, OBJ, struct uniform)
+  DIST_BASE_TYPED(&uniform_ops, OBJ, struct uniform_t)
 
 /** Only by unittests */
 
diff --git a/src/test/test_prob_distr.c b/src/test/test_prob_distr.c
index 0ecbf65f4..e2a51b49f 100644
--- a/src/test/test_prob_distr.c
+++ b/src/test/test_prob_distr.c
@@ -946,7 +946,7 @@ psi_test(const size_t C[PSI_DF], const double logP[PSI_DF], size_t N)
 static bool
 test_stochastic_geometric_impl(double p)
 {
-  const struct geometric geometric = {
+  const struct geometric_t geometric = {
     .base = GEOMETRIC(geometric),
     .p = p,
   };
@@ -1012,7 +1012,8 @@ test_stochastic_geometric_impl(double p)
  * +inf, and x_i = i*(hi - lo)/(n - 2).
  */
 static void
-bin_cdfs(const struct dist *dist, double lo, double hi, double *logP, size_t n)
+bin_cdfs(const struct dist_t *dist, double lo, double hi, double *logP,
+         size_t n)
 {
 #define CDF(x)  dist_cdf(dist, x)
 #define SF(x)   dist_sf(dist, x)
@@ -1059,7 +1060,8 @@ bin_cdfs(const struct dist *dist, double lo, double hi, double *logP, size_t n)
  * +inf, and x_i = i*(hi - lo)/(n - 2).
  */
 static void
-bin_samples(const struct dist *dist, double lo, double hi, size_t *C, size_t n)
+bin_samples(const struct dist_t *dist, double lo, double hi, size_t *C,
+            size_t n)
 {
   const double w = (hi - lo)/(n - 2);
   size_t i;
@@ -1088,7 +1090,7 @@ bin_samples(const struct dist *dist, double lo, double hi, size_t *C, size_t n)
  * 0.01^2 = 0.0001.
  */
 static bool
-test_psi_dist_sample(const struct dist *dist)
+test_psi_dist_sample(const struct dist_t *dist)
 {
   double logP[PSI_DF] = {0};
   unsigned ntry = NTRIALS, npass = 0;
@@ -1134,32 +1136,32 @@ test_stochastic_uniform(void *arg)
 {
   (void) arg;
 
-  const struct uniform uniform01 = {
+  const struct uniform_t uniform01 = {
     .base = UNIFORM(uniform01),
     .a = 0,
     .b = 1,
   };
-  const struct uniform uniform_pos = {
+  const struct uniform_t uniform_pos = {
     .base = UNIFORM(uniform_pos),
     .a = 1.23,
     .b = 4.56,
   };
-  const struct uniform uniform_neg = {
+  const struct uniform_t uniform_neg = {
     .base = UNIFORM(uniform_neg),
     .a = -10,
     .b = -1,
   };
-  const struct uniform uniform_cross = {
+  const struct uniform_t uniform_cross = {
     .base = UNIFORM(uniform_cross),
     .a = -1.23,
     .b = 4.56,
   };
-  const struct uniform uniform_subnormal = {
+  const struct uniform_t uniform_subnormal = {
     .base = UNIFORM(uniform_subnormal),
     .a = 4e-324,
     .b = 4e-310,
   };
-  const struct uniform uniform_subnormal_cross = {
+  const struct uniform_t uniform_subnormal_cross = {
     .base = UNIFORM(uniform_subnormal_cross),
     .a = -4e-324,
     .b = 4e-310,
@@ -1189,7 +1191,7 @@ test_stochastic_uniform(void *arg)
 static bool
 test_stochastic_logistic_impl(double mu, double sigma)
 {
-  const struct logistic dist = {
+  const struct logistic_t dist = {
     .base = LOGISTIC(dist),
     .mu = mu,
     .sigma = sigma,
@@ -1202,7 +1204,7 @@ test_stochastic_logistic_impl(double mu, double sigma)
 static bool
 test_stochastic_log_logistic_impl(double alpha, double beta)
 {
-  const struct log_logistic dist = {
+  const struct log_logistic_t dist = {
     .base = LOG_LOGISTIC(dist),
     .alpha = alpha,
     .beta = beta,
@@ -1215,7 +1217,7 @@ test_stochastic_log_logistic_impl(double alpha, double beta)
 static bool
 test_stochastic_weibull_impl(double lambda, double k)
 {
-  const struct weibull dist = {
+  const struct weibull_t dist = {
     .base = WEIBULL(dist),
     .lambda = lambda,
     .k = k,
@@ -1235,7 +1237,7 @@ test_stochastic_weibull_impl(double lambda, double k)
 static bool
 test_stochastic_genpareto_impl(double mu, double sigma, double xi)
 {
-  const struct genpareto dist = {
+  const struct genpareto_t dist = {
     .base = GENPARETO(dist),
     .mu = mu,
     .sigma = sigma,



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits