PPCODE:
XPUSHs(self->str);
-char*
-mod(re::engine::Plugin self, ...)
+void
+mod(re::engine::Plugin self)
+PREINIT:
+ U32 flags;
+ char mods[5 + 1];
+ int n = 0, i;
PPCODE:
- /* /i */
- if (self->rx->intflags & PMf_FOLD) {
- XPUSHs(sv_2mortal(newSVpvs("i")));
- XPUSHs(&PL_sv_yes);
- }
-
- /* /m */
- if (self->rx->intflags & PMf_MULTILINE) {
- XPUSHs(sv_2mortal(newSVpvs("m")));
- XPUSHs(&PL_sv_yes);
- }
-
- /* /s */
- if (self->rx->intflags & PMf_SINGLELINE) {
- XPUSHs(sv_2mortal(newSVpvs("s")));
- XPUSHs(&PL_sv_yes);
- }
-
- /* /x */
- if (self->rx->intflags & PMf_EXTENDED) {
- XPUSHs(sv_2mortal(newSVpvs("x")));
- XPUSHs(&PL_sv_yes);
- }
-
- /* /p */
- if (self->rx->intflags & RXf_PMf_KEEPCOPY) {
- XPUSHs(sv_2mortal(newSVpvs("p")));
- XPUSHs(&PL_sv_yes);
+ flags = self->rx->intflags;
+ if (flags & PMf_FOLD) /* /i */
+ mods[n++] = 'i';
+ if (flags & PMf_MULTILINE) /* /m */
+ mods[n++] = 'm';
+ if (flags & PMf_SINGLELINE) /* /s */
+ mods[n++] = 's';
+ if (flags & PMf_EXTENDED) /* /x */
+ mods[n++] = 'x';
+ if (flags & RXf_PMf_KEEPCOPY) /* /p */
+ mods[n++] = 'p';
+ mods[n] = '\0';
+ EXTEND(SP, 2 * n);
+ for (i = 0; i < n; ++i) {
+ mPUSHp(mods + i, 1);
+ PUSHs(&PL_sv_yes);
}
+ XSRETURN(2 * n);
void
stash(re::engine::Plugin self, ...)