aboutsummaryrefslogtreecommitdiffstats
path: root/URPM.xs
diff options
context:
space:
mode:
Diffstat (limited to 'URPM.xs')
-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;