Mailinglist Archive: zypp-commit (171 mails)

< Previous Next >
[zypp-commit] <sat-solver> master : More const
  • From: Klaus Kämpf <kkaempf@xxxxxxx>
  • Date: Mon, 22 Jun 2009 15:44:16 +0200
  • Message-id: <E1MIjop-0003YO-Q2@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit f249859ff191689de4059b7b86e733c20da57248
Author: Klaus Kämpf <kkaempf@xxxxxxx>
Date: Mon Jun 22 15:44:16 2009 +0200

More const
---
applayer/ruleinfo.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++
applayer/ruleinfo.h | 42 +++++++++++++++++++++++++++++++++
src/pool.h | 2 +-
3 files changed, 107 insertions(+), 1 deletions(-)

diff --git a/applayer/ruleinfo.c b/applayer/ruleinfo.c
new file mode 100644
index 0000000..1e13601
--- /dev/null
+++ b/applayer/ruleinfo.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
+ * Ruleinfo
+ *
+ * Information about a single solver rule.
+ *
+ */
+
+#include <stdlib.h>
+
+#include "ruleinfo.h"
+
+#include "applayer.h"
+
+
+Ruleinfo *
+ruleinfo_new( const Solver *solver, Id rule )
+{
+ Ruleinfo *ri = (Ruleinfo *)calloc( 1, sizeof( Ruleinfo ));
+ ri->solver = solver;
+ ri->cmd = solver_ruleinfo(solver, rule, &(ri->source), &(ri->target),
&(ri->dep));
+ return ri;
+}
+
+
+void
+ruleinfo_free( Ruleinfo *ri )
+{
+ free( ri );
+}
+
+
+int
+command(const Ruleinfo *ri)
+{
+ return ri->cmd;
+}
+
+
+XSolvable *
+source(const Ruleinfo *ri)
+{
+ return ri->source ? xsolvable_new( ri->solver->pool, ri->source ) : NULL;
+}
+
+
+XSolvable *
+target(const Ruleinfo *ri)
+{
+ return ri->target ? xsolvable_new( ri->solver->pool, ri->target ) : NULL;
+}
+
+
+Relation *
+relation(const Ruleinfo *ri)
+{
+ return ri->dep ? relation_new( ri->solver->pool, ri->dep ) : NULL;
+}
diff --git a/applayer/ruleinfo.h b/applayer/ruleinfo.h
new file mode 100644
index 0000000..1f24093
--- /dev/null
+++ b/applayer/ruleinfo.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2007, Novell Inc.
+ *
+ * This program is licensed under the BSD license, read LICENSE.BSD
+ * for further information
+ */
+
+/*
+ * Ruleinfo
+ *
+ * Information about a single solver rule.
+ *
+ */
+
+
+#ifndef SATSOLVER_RULEINFO_H
+#define SATSOLVER_RULEINFO_H
+
+#include "pool.h"
+#include "solver.h"
+
+#include "xsolvable.h"
+#include "relation.h"
+
+typedef struct _Ruleinfo {
+ const Solver *solver;
+ int cmd;
+ Id source;
+ Id target;
+ Id dep;
+} Ruleinfo;
+
+
+Ruleinfo *ruleinfo_new( const Solver *solver, Id rule );
+void ruleinfo_free( Ruleinfo *ri );
+
+int command(const Ruleinfo *ri);
+XSolvable *source(const Ruleinfo *ri);
+XSolvable *target(const Ruleinfo *ri);
+Relation *relation(const Ruleinfo *ri);
+
+#endif /* SATSOLVER_RULEINFO_H */
diff --git a/src/pool.h b/src/pool.h
index e8b0fe0..c24ecc5 100644
--- a/src/pool.h
+++ b/src/pool.h
@@ -184,7 +184,7 @@ extern Id pool_add_solvable(Pool *pool);
extern Id pool_add_solvable_block(Pool *pool, int count);

extern void pool_free_solvable_block(Pool *pool, Id start, int count, int
reuseids);
-static inline Solvable *pool_id2solvable(Pool *pool, Id p)
+static inline Solvable *pool_id2solvable(const Pool *pool, Id p)
{
return pool->solvables + p;
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages