Mailinglist Archive: zypp-commit (171 mails)

< Previous Next >
[zypp-commit] <sat-solver> master : - make out parameters last in function calls
  • From: Michael Schroeder <mls@xxxxxxx>
  • Date: Mon, 15 Jun 2009 16:33:01 +0200
  • Message-id: <E1MGDFp-0008MR-4o@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 20b7e09307f502f89f0d61cf3177ee98c4ddf2b4
Author: Michael Schroeder <mls@xxxxxxx>
Date: Mon Jun 15 16:33:01 2009 +0200

- make out parameters last in function calls
- rename "class" parameter, as g++ chokes otherwise
---
src/solverdebug.c | 4 ++--
src/transaction.c | 6 +++---
src/transaction.h | 31 ++++++++++++++++++++++++-------
3 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/src/solverdebug.c b/src/solverdebug.c
index 4ac561f..c0759f2 100644
--- a/src/solverdebug.c
+++ b/src/solverdebug.c
@@ -410,7 +410,7 @@ solver_printtransaction(Solver *solv)
queue_init(&classes);
queue_init(&pkgs);
mode = 0;
- transaction_classify(trans, &classes, mode);
+ transaction_classify(trans, mode, &classes);
for (i = 0; i < classes.count; i += 4)
{
Id class = classes.elements[i];
@@ -447,7 +447,7 @@ solver_printtransaction(Solver *solv)
}
if (class == SOLVER_TRANSACTION_IGNORE)
continue;
- transaction_classify_pkgs(trans, &pkgs, mode, class, classes.elements[i
+ 2], classes.elements[i + 3]);
+ transaction_classify_pkgs(trans, mode, class, classes.elements[i + 2],
classes.elements[i + 3], &pkgs);
*line = 0;
linel = 0;
for (j = 0; j < pkgs.count; j++)
diff --git a/src/transaction.c b/src/transaction.c
index f5d51b3..1e94df4 100644
--- a/src/transaction.c
+++ b/src/transaction.c
@@ -388,7 +388,7 @@ classify_cmp_pkgs(const void *ap, const void *bp, void *dp)
}

void
-transaction_classify(Transaction *trans, Queue *classes, int mode)
+transaction_classify(Transaction *trans, int mode, Queue *classes)
{
Pool *pool = trans->pool;
int ntypes[SOLVER_TRANSACTION_MAXTYPE];
@@ -479,7 +479,7 @@ transaction_classify(Transaction *trans, Queue *classes,
int mode)
}

void
-transaction_classify_pkgs(Transaction *trans, Queue *pkgs, int mode, Id class,
Id from, Id to)
+transaction_classify_pkgs(Transaction *trans, int mode, Id class, Id from, Id
to, Queue *pkgs)
{
Pool *pool = trans->pool;
int i;
@@ -1725,7 +1725,7 @@ printf("free %s [%d]\n", solvid2str(pool, te2->p),
temedianr[od.invedgedata[j]])


int
-transaction_order_add_choices(Transaction *trans, Queue *choices, Id chosen)
+transaction_order_add_choices(Transaction *trans, Id chosen, Queue *choices)
{
int i, j;
struct _TransactionOrderdata *od = trans->orderdata;
diff --git a/src/transaction.h b/src/transaction.h
index 2e0a130..deecaeb 100644
--- a/src/transaction.h
+++ b/src/transaction.h
@@ -61,7 +61,7 @@ typedef struct _Transaction {

#define SOLVER_TRANSACTION_MAXTYPE 0x3f

-/* show modes */
+/* modes */
#define SOLVER_TRANSACTION_SHOW_ACTIVE (1 << 0)
#define SOLVER_TRANSACTION_SHOW_ALL (1 << 1)
#define SOLVER_TRANSACTION_SHOW_OBSOLETES (1 << 2)
@@ -76,21 +76,38 @@ typedef struct _Transaction {
#define SOLVER_TRANSACTION_ARCHCHANGE 0x100
#define SOLVER_TRANSACTION_VENDORCHANGE 0x101

+/* order flags */
+#define SOLVER_TRANSACTION_KEEP_ORDERDATA (1 << 0)
+
extern void transaction_init(Transaction *trans, struct _Pool *pool);
extern void transaction_free(Transaction *trans);
extern void transaction_calculate(Transaction *trans, Queue *decisionq, Map
*noobsmap);
-extern void transaction_all_obs_pkgs(Transaction *trans, Id p, Queue *pkgs);
+
+/* if p is installed, returns with pkg(s) obsolete p */
+/* if p is not installed, returns with pkg(s) we obsolete */
extern Id transaction_obs_pkg(Transaction *trans, Id p);
+extern void transaction_all_obs_pkgs(Transaction *trans, Id p, Queue *pkgs);
+
+/* return step type of a transaction element */
extern Id transaction_type(Transaction *trans, Id p, int mode);
-extern void transaction_classify(Transaction *trans, Queue *classes, int mode);
-extern void transaction_classify_pkgs(Transaction *trans, Queue *pkgs, int
mode, Id class, Id from, Id to);

+/* return sorted collection of all step types */
+/* classify_pkgs can be used to return all packages of a type */
+extern void transaction_classify(Transaction *trans, int mode, Queue *classes);
+extern void transaction_classify_pkgs(Transaction *trans, int mode, Id type,
Id from, Id to, Queue *pkgs);
+
+/* order a transaction */
extern void transaction_order(Transaction *trans, int flags);
-extern int transaction_order_add_choices(Transaction *trans, Queue *choices,
Id chosen);
+
+/* roll your own order funcion:
+ * add pkgs free for installation to queue choices after chosen was
+ * installed. start with chosen = 0
+ * needs an ordered transaction created with SOLVER_TRANSACTION_KEEP_ORDERDATA
*/
+extern int transaction_order_add_choices(Transaction *trans, Id chosen, Queue
*choices);
+
+/* debug function, report problems found in the order */
extern void transaction_check_order(Transaction *trans);

-/* order flags */
-#define SOLVER_TRANSACTION_KEEP_ORDERDATA (1 << 0)

#ifdef __cplusplus
}
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages