aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--URPM.xs33
1 files changed, 15 insertions, 18 deletions
diff --git a/URPM.xs b/URPM.xs
index 9be7186..5b61c4c 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -1374,6 +1374,19 @@ rpmtag_from_string(char *tag)
else croak("unknown tag [%s]", tag);
}
+static void push_rflags(URPM__Package pkg, int gimme) {
+ dSP;
+ if (gimme == G_ARRAY && pkg->rflags != NULL) {
+ char *s = pkg->rflags;
+ char *eos;
+ while ((eos = strchr(s, '\t')) != NULL) {
+ mXPUSHs(newSVpv(s, eos-s));
+ s = eos + 1;
+ }
+ mXPUSHs(newSVpv(s, 0));
+ }
+}
+
MODULE = URPM PACKAGE = URPM::Package PREFIX = Pkg_
void
@@ -2355,15 +2368,7 @@ Pkg_rflags(pkg)
PREINIT:
I32 gimme = GIMME_V;
PPCODE:
- if (gimme == G_ARRAY && pkg->rflags != NULL) {
- char *s = pkg->rflags;
- char *eos;
- while ((eos = strchr(s, '\t')) != NULL) {
- mXPUSHs(newSVpv(s, eos-s));
- s = eos + 1;
- }
- mXPUSHs(newSVpv(s, 0));
- }
+ push_rflags(pkg, gimme);
void
Pkg_set_rflags(pkg, ...)
@@ -2389,15 +2394,7 @@ Pkg_set_rflags(pkg, ...)
}
new_rflags[total_len - 1] = 0; /* but mark end-of-string correctly */
- if (gimme == G_ARRAY && pkg->rflags != NULL) {
- char *s = pkg->rflags;
- char *eos;
- while ((eos = strchr(s, '\t')) != NULL) {
- mXPUSHs(newSVpv(s, eos-s));
- s = eos + 1;
- }
- mXPUSHs(newSVpv(s, 0));
- }
+ push_rflags(pkg, gimme);
free(pkg->rflags);
pkg->rflags = new_rflags;