aboutsummaryrefslogtreecommitdiffstats
path: root/URPM.xs
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-09-27 14:02:51 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-09-27 14:02:51 +0000
commit6a768c186358f6e39647001acff9f2d01761b554 (patch)
treead0d3d980e13bd78ab6983c72030586e8eb3ce9f /URPM.xs
parent1273ceda9a7ba3b7c30273e2e0256b1f9c6b0203 (diff)
downloadperl-URPM-6a768c186358f6e39647001acff9f2d01761b554.tar
perl-URPM-6a768c186358f6e39647001acff9f2d01761b554.tar.gz
perl-URPM-6a768c186358f6e39647001acff9f2d01761b554.tar.bz2
perl-URPM-6a768c186358f6e39647001acff9f2d01761b554.tar.xz
perl-URPM-6a768c186358f6e39647001acff9f2d01761b554.zip
create update_hash_entry() out of update_provide_entry() for next commits
Diffstat (limited to 'URPM.xs')
-rw-r--r--URPM.xs18
1 files changed, 14 insertions, 4 deletions
diff --git a/URPM.xs b/URPM.xs
index 29b5591..3b74013 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -803,12 +803,11 @@ pack_header(URPM__Package pkg) {
}
}
-static void
-update_provide_entry(char *name, STRLEN len, int force, IV use_sense, URPM__Package pkg, HV *provides) {
+static SV** update_hash_entry(HV *hash, char *name, STRLEN len, int force) {
SV** isv;
if (!len) len = strlen(name);
- if ((isv = hv_fetch(provides, name, len, force))) {
+ if ((isv = hv_fetch(hash, name, len, force))) {
/* check if an entry has been found or created, it should so be updated */
if (!SvROK(*isv) || SvTYPE(SvRV(*isv)) != SVt_PVHV) {
SV* choice_set = (SV*)newHV();
@@ -820,13 +819,24 @@ update_provide_entry(char *name, STRLEN len, int force, IV use_sense, URPM__Pack
}
}
}
+ return isv;
+ } else {
+ return NULL;
+ }
+}
+
+static void
+update_provide_entry(char *name, STRLEN len, int force, IV use_sense, URPM__Package pkg, HV *provides) {
+ SV** isv;
+
+ isv = update_hash_entry(provides, name, len, force);
+
if (isv && *isv != &PL_sv_undef) {
char id[8];
STRLEN id_len = snprintf(id, sizeof(id), "%d", pkg->flag & FLAG_ID);
SV **sense = hv_fetch((HV*)SvRV(*isv), id, id_len, 1);
if (sense && use_sense) sv_setiv(*sense, use_sense);
}
- }
}
static void