summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/perl/common/Core.xs4
-rw-r--r--src/perl/common/Ignore.xs4
-rw-r--r--src/perl/common/Log.xs4
-rw-r--r--src/perl/common/Server.xs4
-rw-r--r--src/perl/common/Window.xs4
-rw-r--r--src/perl/irc/IrcChannel.xs8
-rw-r--r--src/perl/irc/Notifylist.xs4
-rw-r--r--src/perl/perl-common.h8
8 files changed, 13 insertions, 27 deletions
diff --git a/src/perl/common/Core.xs b/src/perl/common/Core.xs
index ea078b57..e69b5a50 100644
--- a/src/perl/common/Core.xs
+++ b/src/perl/common/Core.xs
@@ -310,11 +310,9 @@ void
commands()
PREINIT:
GSList *tmp;
- HV *stash;
PPCODE:
- stash = gv_stashpv("Irssi::Command", 0);
for (tmp = commands; tmp != NULL; tmp = tmp->next) {
- push_bless(tmp->data, stash);
+ XPUSHs(sv_2mortal(plain_bless(tmp->data, "Irssi::Command")));
}
void
diff --git a/src/perl/common/Ignore.xs b/src/perl/common/Ignore.xs
index 89fb00ba..30b8590c 100644
--- a/src/perl/common/Ignore.xs
+++ b/src/perl/common/Ignore.xs
@@ -4,11 +4,9 @@ void
ignores()
PREINIT:
GSList *tmp;
- HV *stash;
PPCODE:
- stash = gv_stashpv("Irssi::Ignore", 0);
for (tmp = servers; tmp != NULL; tmp = tmp->next) {
- push_bless(tmp->data, stash);
+ XPUSHs(sv_2mortal(plain_bless(tmp->data, "Irssi::Ignore")));
}
int
diff --git a/src/perl/common/Log.xs b/src/perl/common/Log.xs
index 43ebad3c..4879aef9 100644
--- a/src/perl/common/Log.xs
+++ b/src/perl/common/Log.xs
@@ -4,11 +4,9 @@ void
logs()
PREINIT:
GSList *tmp;
- HV *stash;
PPCODE:
- stash = gv_stashpv("Irssi::Log", 0);
for (tmp = logs; tmp != NULL; tmp = tmp->next) {
- push_bless(tmp->data, stash);
+ XPUSHs(sv_2mortal(plain_bless(tmp->data, "Irssi::Log")));
}
Irssi::Log
diff --git a/src/perl/common/Server.xs b/src/perl/common/Server.xs
index eb6aa90d..dd44fe08 100644
--- a/src/perl/common/Server.xs
+++ b/src/perl/common/Server.xs
@@ -13,11 +13,9 @@ void
reconnects()
PREINIT:
GSList *tmp;
- HV *stash;
PPCODE:
- stash = gv_stashpv("Irssi::Reconnect", 0);
for (tmp = reconnects; tmp != NULL; tmp = tmp->next) {
- push_bless(tmp->data, stash);
+ XPUSHs(sv_2mortal(plain_bless(tmp->data, "Irssi::Reconnect")));
}
Irssi::Connect
diff --git a/src/perl/common/Window.xs b/src/perl/common/Window.xs
index 5f082d74..027289cc 100644
--- a/src/perl/common/Window.xs
+++ b/src/perl/common/Window.xs
@@ -4,11 +4,9 @@ void
windows()
PREINIT:
GSList *tmp;
- HV *stash;
PPCODE:
- stash = gv_stashpv("Irssi::Window", 0);
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
- push_bless(tmp->data, stash);
+ XPUSHs(sv_2mortal(plain_bless(tmp->data, "Irssi::Window")));
}
diff --git a/src/perl/irc/IrcChannel.xs b/src/perl/irc/IrcChannel.xs
index 36e40780..fb8ff3fc 100644
--- a/src/perl/irc/IrcChannel.xs
+++ b/src/perl/irc/IrcChannel.xs
@@ -5,11 +5,9 @@ bans(channel)
Irssi::Irc::Channel channel
PREINIT:
GSList *tmp;
- HV *stash;
PPCODE:
- stash = gv_stashpv("Irssi::Irc::Ban", 0);
for (tmp = channel->banlist; tmp != NULL; tmp = tmp->next) {
- push_bless(tmp->data, stash);
+ XPUSHs(sv_2mortal(plain_bless(tmp->data, "Irssi::Irc::Ban")));
}
void
@@ -17,11 +15,9 @@ ebans(channel)
Irssi::Irc::Channel channel
PREINIT:
GSList *tmp;
- HV *stash;
PPCODE:
- stash = gv_stashpv("Irssi::Irc::Ban", 0);
for (tmp = channel->ebanlist; tmp != NULL; tmp = tmp->next) {
- push_bless(tmp->data, stash);
+ XPUSHs(sv_2mortal(plain_bless(tmp->data, "Irssi::Irc::Ban")));
}
void
diff --git a/src/perl/irc/Notifylist.xs b/src/perl/irc/Notifylist.xs
index 2f830639..1951c125 100644
--- a/src/perl/irc/Notifylist.xs
+++ b/src/perl/irc/Notifylist.xs
@@ -4,11 +4,9 @@ void
notifies()
PREINIT:
GSList *tmp;
- HV *stash;
PPCODE:
- stash = gv_stashpv("Irssi::Irc::Notifylist", 0);
for (tmp = notifies; tmp != NULL; tmp = tmp->next) {
- push_bless(tmp->data, stash);
+ XPUSHs(sv_2mortal(plain_bless(tmp->data, "Irssi::Irc::Notifylist")));
}
Irssi::Irc::Notifylist
diff --git a/src/perl/perl-common.h b/src/perl/perl-common.h
index e6519681..5489a77d 100644
--- a/src/perl/perl-common.h
+++ b/src/perl/perl-common.h
@@ -8,9 +8,6 @@
#define new_bless(obj, stash) \
sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(obj))), stash)
-#define push_bless(obj, stash) \
- XPUSHs(sv_2mortal(new_bless(obj, stash)))
-
#define is_hvref(o) \
((o) && SvROK(o) && SvRV(o) && (SvTYPE(SvRV(o)) == SVt_PVHV))
@@ -35,6 +32,11 @@ char *perl_get_package(void);
#define irssi_bless(object) \
((object) == NULL ? &PL_sv_undef : \
irssi_bless_iobject((object)->type, (object)->chat_type, object))
+
+#define plain_bless(object, stash) \
+ ((object) == NULL ? &PL_sv_undef : \
+ irssi_bless_plain(stash, object))
+
SV *irssi_bless_iobject(int type, int chat_type, void *object);
SV *irssi_bless_plain(const char *stash, void *object);
int irssi_is_ref_object(SV *o);