]> granicus.if.org Git - graphviz/commitdiff
make 'solve1' and 'solve2' static functions
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 19 Dec 2021 21:46:44 +0000 (13:46 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 23 Dec 2021 01:04:36 +0000 (17:04 -0800)
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.

lib/pathplan/solvers.c
lib/pathplan/solvers.h

index 4fd9337a9762afcb0c37cdca58c49668a8e81336..a94be07a0091287e9368ecef265f2ddbdfe62eb8 100644 (file)
@@ -12,6 +12,9 @@
 #include <math.h>
 #include <pathplan/solvers.h>
 
+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;
 
index 010f44c8cdd401ffa702be8fa319ca48c8f558a8..9011914d009c1888db2471bc1691f0fb18ea90af 100644 (file)
@@ -15,8 +15,6 @@ extern "C" {
 #endif
 
     extern int solve3(double *, double *);
-    extern int solve2(double *, double *);
-    extern int solve1(double *, double *);
 
 #ifdef __cplusplus
 }