summaryrefslogtreecommitdiffhomepage
path: root/ir/lpp
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2015-12-08 13:08:15 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2015-12-08 13:08:15 +0100
commit9360f8e6eea3acf5d8fa962a87f92ff37b20030d (patch)
tree280babe0d4dc1eed7b26954a31759b402d313a29 /ir/lpp
parent621b7436b374b4420fbedb8b85b2bd956f37af8f (diff)
lpp: Cleanup.
Diffstat (limited to 'ir/lpp')
-rw-r--r--ir/lpp/lpp_solvers.c19
-rw-r--r--ir/lpp/lpp_solvers.h16
2 files changed, 16 insertions, 19 deletions
diff --git a/ir/lpp/lpp_solvers.c b/ir/lpp/lpp_solvers.c
index 62e3173..b624129 100644
--- a/ir/lpp/lpp_solvers.c
+++ b/ir/lpp/lpp_solvers.c
@@ -12,7 +12,13 @@
#include "lpp_gurobi.h"
#include "util.h"
-lpp_solver_t lpp_solvers[] = {
+typedef struct lpp_solver_t {
+ lpp_solver_func_t *solver;
+ char const *name;
+ int n_instances;
+} lpp_solver_t;
+
+static lpp_solver_t const lpp_solvers[] = {
#ifdef WITH_CPLEX
{ lpp_solve_cplex, "cplex", 1 },
#endif
@@ -22,16 +28,15 @@ lpp_solver_t lpp_solvers[] = {
{ NULL, NULL, 0 }
};
-lpp_solver_func_t *lpp_find_solver(const char *name)
+lpp_solver_func_t *lpp_find_solver(char const *const name)
{
- int i;
-
if (name[0] == '\0')
return lpp_solvers[0].solver;
- for(i = 0; lpp_solvers[i].solver != NULL; i++)
- if (streq(lpp_solvers[i].name, name))
- return lpp_solvers[i].solver;
+ for (lpp_solver_t const *i = lpp_solvers; i->solver; ++i) {
+ if (streq(i->name, name))
+ return i->solver;
+ }
return NULL;
}
diff --git a/ir/lpp/lpp_solvers.h b/ir/lpp/lpp_solvers.h
index b4bc30c..e6fed81 100644
--- a/ir/lpp/lpp_solvers.h
+++ b/ir/lpp/lpp_solvers.h
@@ -7,24 +7,16 @@
* @file
* @author Sebastian Hack
*/
-#ifndef LPP_LPP_SOLVER_H
-#define LPP_LPP_SOLVER_H
+#ifndef LPP_LPP_SOLVERS_H
+#define LPP_LPP_SOLVERS_H
#include "lpp.h"
-typedef void (lpp_solver_func_t)(lpp_t *lpp);
-
-typedef struct {
- lpp_solver_func_t *solver;
- const char *name;
- int n_instances;
-} lpp_solver_t;
-
-extern lpp_solver_t lpp_solvers[];
+typedef void lpp_solver_func_t(lpp_t *lpp);
/**
* Find a solver for a given name.
*/
-lpp_solver_func_t *lpp_find_solver(const char *name);
+lpp_solver_func_t *lpp_find_solver(char const *name);
#endif