Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=584fc13851f21398ca2a975e6958bdd1412bc573

commit 584fc13851f21398ca2a975e6958bdd1412bc573
Author: Michel Hermier <herm...@frugalware.org>
Date:   Wed May 7 09:53:32 2014 +0200

libpacman: s/_pacman_trans_commit/__pmtrans_t::commit/

diff --git a/lib/libpacman/pacman.cpp b/lib/libpacman/pacman.cpp
index 4bf1437..89f198c 100644
--- a/lib/libpacman/pacman.cpp
+++ b/lib/libpacman/pacman.cpp
@@ -1200,7 +1200,7 @@ int pacman_trans_commit(pmlist_t **data)
ASSERT((handle->access == PM_ACCESS_RW) || (handle->trans->flags & 
PM_TRANS_FLAG_PRINTURIS),
RET_ERR(PM_ERR_BADPERMS, -1));

-       return(_pacman_trans_commit(handle->trans, data));
+       return handle->trans->commit(data);
}

/** Release a transaction.
diff --git a/lib/libpacman/sync.cpp b/lib/libpacman/sync.cpp
index ea3f3d2..f4f8d37 100644
--- a/lib/libpacman/sync.cpp
+++ b/lib/libpacman/sync.cpp
@@ -651,7 +651,7 @@ int _pacman_sync_commit(pmtrans_t *trans, pmlist_t **data)
}
/* we want the frontend to be aware of commit details */
tr->cbs.event = trans->cbs.event;
-               if(_pacman_trans_commit(tr, NULL) == -1) {
+               if(tr->commit(NULL) == -1) {
_pacman_log(PM_LOG_ERROR, _("could not commit removal transaction"));
goto error;
}
@@ -689,7 +689,7 @@ int _pacman_sync_commit(pmtrans_t *trans, pmlist_t **data)
/* pm_errno is set by trans_prepare */
goto error;
}
-       if(_pacman_trans_commit(tr, NULL) == -1) {
+       if(tr->commit(NULL) == -1) {
_pacman_log(PM_LOG_ERROR, _("could not commit transaction"));
goto error;
}
diff --git a/lib/libpacman/trans.cpp b/lib/libpacman/trans.cpp
index 4a47838..fcb33a4 100644
--- a/lib/libpacman/trans.cpp
+++ b/lib/libpacman/trans.cpp
@@ -1350,42 +1350,39 @@ int _pacman_remove_commit(pmtrans_t *trans, pmlist_t 
**data)
return(0);
}

-int _pacman_trans_commit(pmtrans_t *trans, pmlist_t **data)
+int __pmtrans_t::commit(pmlist_t **data)
{
-       /* Sanity checks */
-       ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
-
if(data!=NULL)
*data = NULL;

/* If there's nothing to do, return without complaining */
-       if(_pacman_list_empty(trans->packages) &&
-               _pacman_list_empty(trans->syncpkgs)) {
+       if(_pacman_list_empty(packages) &&
+               _pacman_list_empty(syncpkgs)) {
return(0);
}

-       _pacman_trans_set_state(trans, STATE_COMMITING);
+       _pacman_trans_set_state(this, STATE_COMMITING);

-       if(trans->ops != NULL && trans->ops->commit != NULL) {
-               if(trans->ops->commit(trans, data) == -1) {
-                       /* pm_errno is set by trans->ops->commit() */
-                       _pacman_trans_set_state(trans, STATE_PREPARED);
+       if(ops != NULL && ops->commit != NULL) {
+               if(ops->commit(this, data) == -1) {
+                       /* pm_errno is set by ops->commit() */
+                       _pacman_trans_set_state(this, STATE_PREPARED);
return(-1);
}
} else {
-       if(trans->type & PM_TRANS_TYPE_ADD) {
-               if(_pacman_add_commit(trans, data) == -1) {
+       if(type & PM_TRANS_TYPE_ADD) {
+               if(_pacman_add_commit(this, data) == -1) {
return -1;
}
}
-       if(trans->type == PM_TRANS_TYPE_REMOVE) {
-               if(_pacman_remove_commit(trans, data) == -1) {
+       if(type == PM_TRANS_TYPE_REMOVE) {
+               if(_pacman_remove_commit(this, data) == -1) {
return -1;
}
}
}

-       _pacman_trans_set_state(trans, STATE_COMMITED);
+       _pacman_trans_set_state(this, STATE_COMMITED);

return(0);
}
diff --git a/lib/libpacman/trans.h b/lib/libpacman/trans.h
index d148f73..169e77e 100644
--- a/lib/libpacman/trans.h
+++ b/lib/libpacman/trans.h
@@ -68,6 +68,7 @@ struct __pmtrans_t
pmsyncpkg_t *find(const char *pkgname) const;

int prepare(pmlist_t **data);
+       int commit(pmlist_t **data);

const pmtrans_ops_t *ops;
int (*set_state)(pmtrans_t *trans, int new_state);
@@ -106,7 +107,6 @@ pmsyncpkg_t *_pacman_trans_add(pmtrans_t *trans, 
pmsyncpkg_t *syncpkg, int flags
int _pacman_trans_add_package(pmtrans_t *trans, pmpkg_t *pkg, pmtranstype_t 
type, int flags);
pmsyncpkg_t *_pacman_trans_add_target(pmtrans_t *trans, const char *target, 
pmtranstype_t type, int flags);
int _pacman_trans_addtarget(pmtrans_t *trans, const char *target);
-int _pacman_trans_commit(pmtrans_t *trans, pmlist_t **data);

int _pacman_trans_sysupgrade(pmtrans_t *trans);
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to