From: Matthew Fernandez Date: Sun, 19 Dec 2021 21:46:44 +0000 (-0800) Subject: make 'solve1' and 'solve2' static functions X-Git-Tag: 3.0.0~113^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f2b057a33b9c1c943e73ec007e2f59429b94090a;p=graphviz make 'solve1' and 'solve2' static functions As of 9550d5dae1a487617a8910b1b496ffd12c78a546, these functions are no longer exported or needed outside of solvers.c. `solve3` has occasionally been a hotspot for performance-constrained Graphviz use cases. So making it more obvious to the compiler that it can inline and/or specialize `solve1` and `solve2` may provide some speed up. --- diff --git a/lib/pathplan/solvers.c b/lib/pathplan/solvers.c index 4fd9337a9..a94be07a0 100644 --- a/lib/pathplan/solvers.c +++ b/lib/pathplan/solvers.c @@ -12,6 +12,9 @@ #include #include +static int solve1(double *coeff, double *roots); +static int solve2(double *coeff, double *roots); + #ifndef M_PI #define M_PI 3.14159265358979323846 #endif @@ -62,7 +65,7 @@ int solve3(double *coeff, double *roots) return rootn; } -int solve2(double *coeff, double *roots) +static int solve2(double *coeff, double *roots) { double a, b, c; double disc, b_over_2a, c_over_a; @@ -85,7 +88,7 @@ int solve2(double *coeff, double *roots) return 1; } -int solve1(double *coeff, double *roots) +static int solve1(double *coeff, double *roots) { double a, b; diff --git a/lib/pathplan/solvers.h b/lib/pathplan/solvers.h index 010f44c8c..9011914d0 100644 --- a/lib/pathplan/solvers.h +++ b/lib/pathplan/solvers.h @@ -15,8 +15,6 @@ extern "C" { #endif extern int solve3(double *, double *); - extern int solve2(double *, double *); - extern int solve1(double *, double *); #ifdef __cplusplus }