aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-07-01 15:26:25 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-07-01 15:26:25 +0000
commitc996c914bd341372a90ef251a9fe0bafe8ff7606 (patch)
treea1ad2a300d62b2be461cd3af3c90c72486167847
parent46097a38f412a36c37f7932162d6eba8de63d521 (diff)
downloadperl-URPM-c996c914bd341372a90ef251a9fe0bafe8ff7606.tar
perl-URPM-c996c914bd341372a90ef251a9fe0bafe8ff7606.tar.gz
perl-URPM-c996c914bd341372a90ef251a9fe0bafe8ff7606.tar.bz2
perl-URPM-c996c914bd341372a90ef251a9fe0bafe8ff7606.tar.xz
perl-URPM-c996c914bd341372a90ef251a9fe0bafe8ff7606.zip
create rpmtag_from_string() out of Db_traverse_tag
-rw-r--r--URPM.xs34
1 files changed, 19 insertions, 15 deletions
diff --git a/URPM.xs b/URPM.xs
index 29d4078..5a30d22 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -1437,6 +1437,24 @@ static void *rpmRunTransactions_callback(const void *h,
return callback == td->callback_open ? fd : NULL;
}
+int rpmtag_from_string(char *tag)
+{
+ if (!strcmp(tag, "name"))
+ return RPMTAG_NAME;
+ else if (!strcmp(tag, "whatprovides"))
+ return RPMTAG_PROVIDENAME;
+ else if (!strcmp(tag, "whatrequires"))
+ return RPMTAG_REQUIRENAME;
+ else if (!strcmp(tag, "whatconflicts"))
+ return RPMTAG_CONFLICTNAME;
+ else if (!strcmp(tag, "group"))
+ return RPMTAG_GROUP;
+ else if (!strcmp(tag, "triggeredby"))
+ return RPMTAG_TRIGGERNAME;
+ else if (!strcmp(tag, "path"))
+ return RPMTAG_BASENAMES;
+ else croak("unknown tag [%s]", tag);
+}
MODULE = URPM PACKAGE = URPM::Package PREFIX = Pkg_
@@ -2867,21 +2885,7 @@ Db_traverse_tag(db,tag,names,callback)
int len = av_len(names_av);
int i, rpmtag;
- if (!strcmp(tag, "name"))
- rpmtag = RPMTAG_NAME;
- else if (!strcmp(tag, "whatprovides"))
- rpmtag = RPMTAG_PROVIDENAME;
- else if (!strcmp(tag, "whatrequires"))
- rpmtag = RPMTAG_REQUIRENAME;
- else if (!strcmp(tag, "whatconflicts"))
- rpmtag = RPMTAG_CONFLICTNAME;
- else if (!strcmp(tag, "group"))
- rpmtag = RPMTAG_GROUP;
- else if (!strcmp(tag, "triggeredby"))
- rpmtag = RPMTAG_TRIGGERNAME;
- else if (!strcmp(tag, "path"))
- rpmtag = RPMTAG_BASENAMES;
- else croak("unknown tag [%s]", tag);
+ rpmtag = rpmtag_from_string(tag);
for (i = 0; i <= len; ++i) {
STRLEN str_len;