aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-11-01 14:50:04 +0000
committerThierry Vignaud <tv@mageia.org>2012-11-01 14:50:04 +0000
commit3d9487c1f6c1c9a27dfdcf647c4813ba29be2788 (patch)
treec44e6fa66d37e7248593b106683c93f8a4284f8d
parent2eb9a8ecab19d4648a3deea82a0bd18104c48109 (diff)
downloadperl-URPM-3d9487c1f6c1c9a27dfdcf647c4813ba29be2788.tar
perl-URPM-3d9487c1f6c1c9a27dfdcf647c4813ba29be2788.tar.gz
perl-URPM-3d9487c1f6c1c9a27dfdcf647c4813ba29be2788.tar.bz2
perl-URPM-3d9487c1f6c1c9a27dfdcf647c4813ba29be2788.tar.xz
perl-URPM-3d9487c1f6c1c9a27dfdcf647c4813ba29be2788.zip
(_run_cb_while_traversing) enable to pass additional flags
(Db_traverse,Db_traverse_tag) discard callback results prior to introducing _run_cb_while_traversing() in commit r4947 on Jun 14 2012: "(_run_cb_while_traversing) introduce this helper"
-rw-r--r--URPM.xs10
1 files changed, 5 insertions, 5 deletions
diff --git a/URPM.xs b/URPM.xs
index d7dd26c..ce8c8c2 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -110,7 +110,7 @@ static int rpmError_callback() {
return RPMLOG_DEFAULT;
}
-static inline int _run_cb_while_traversing(SV *callback, Header header) {
+static inline int _run_cb_while_traversing(SV *callback, Header header, VOL I32 flags) {
dSP;
URPM__Package pkg = calloc(1, sizeof(struct s_Package));
@@ -121,7 +121,7 @@ static inline int _run_cb_while_traversing(SV *callback, Header header) {
mXPUSHs(sv_setref_pv(newSVpvs(""), "URPM::Package", pkg));
PUTBACK;
- int count = call_sv(callback, G_SCALAR);
+ int count = call_sv(callback, G_SCALAR | flags);
SPAGAIN;
pkg->h = NULL; /* avoid using it anymore, in case it has been copied inside callback */
@@ -2416,7 +2416,7 @@ Db_traverse(db,callback)
mi = rpmtsInitIterator(db->ts, RPMDBI_PACKAGES, NULL, 0);
while ((header = rpmdbNextIterator(mi))) {
if (SvROK(callback)) {
- _run_cb_while_traversing(callback, header);
+ _run_cb_while_traversing(callback, header, G_DISCARD);
}
++count;
}
@@ -2454,7 +2454,7 @@ Db_traverse_tag(db,tag,names,callback)
mi = rpmtsInitIterator(db->ts, rpmtag, name, str_len);
while ((header = rpmdbNextIterator(mi))) {
if (SvROK(callback)) {
- _run_cb_while_traversing(callback, header);
+ _run_cb_while_traversing(callback, header, G_DISCARD);
}
++count;
}
@@ -2484,7 +2484,7 @@ Db_traverse_tag_find(db,tag,name,callback)
ovsflags = ts_nosignature(db->ts);
mi = rpmtsInitIterator(db->ts, rpmtag, name, 0);
while ((header = rpmdbNextIterator(mi))) {
- int count = _run_cb_while_traversing(callback, header);
+ int count = _run_cb_while_traversing(callback, header, 0);
if (count == 1 && POPi) {
found = 1;