summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-06-26 17:01:42 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-06-26 17:01:42 +0000
commit740f041c266c92d905754bbcb342b1e69d0770fe (patch)
tree0ce03b703e071d2b298df426f519235080d42ed5
parentd0de9fe229ab0d8ae1f61f7460fdf87d71f7344d (diff)
downloadirssi-740f041c266c92d905754bbcb342b1e69d0770fe.zip
Perl blessing fixes.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1566 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/perl/irc/Irc.xs15
-rw-r--r--src/perl/perl-common.c6
-rw-r--r--src/perl/perl-common.h3
-rw-r--r--src/perl/perl-fe.c11
4 files changed, 11 insertions, 24 deletions
diff --git a/src/perl/irc/Irc.xs b/src/perl/irc/Irc.xs
index 9bde4296..1213fdd3 100644
--- a/src/perl/irc/Irc.xs
+++ b/src/perl/irc/Irc.xs
@@ -24,8 +24,6 @@ static void perl_ban_fill_hash(HV *hv, BAN_REC *ban)
static void perl_dcc_fill_hash(HV *hv, DCC_REC *dcc)
{
- HV *stash;
-
hv_store(hv, "type", 4, new_pv(dcc_type2str(dcc->type)), 0);
hv_store(hv, "orig_type", 9, new_pv(dcc_type2str(dcc->orig_type)), 0);
hv_store(hv, "created", 7, newSViv(dcc->created), 0);
@@ -35,8 +33,7 @@ static void perl_dcc_fill_hash(HV *hv, DCC_REC *dcc)
hv_store(hv, "mynick", 6, new_pv(dcc->mynick), 0);
hv_store(hv, "nick", 4, new_pv(dcc->nick), 0);
- stash = gv_stashpv("Irssi::Irc::Dcc::Chat", 0);
- hv_store(hv, "chat", 4, new_bless(dcc->chat, stash), 0);
+ hv_store(hv, "chat", 4, dcc_bless(dcc->chat), 0);
hv_store(hv, "target", 6, new_pv(dcc->target), 0);
hv_store(hv, "arg", 3, new_pv(dcc->arg), 0);
@@ -77,20 +74,20 @@ static void perl_dcc_send_fill_hash(HV *hv, SEND_DCC_REC *dcc)
static void perl_netsplit_fill_hash(HV *hv, NETSPLIT_REC *netsplit)
{
AV *av;
- HV *stash;
GSList *tmp;
hv_store(hv, "nick", 4, new_pv(netsplit->nick), 0);
hv_store(hv, "address", 7, new_pv(netsplit->address), 0);
hv_store(hv, "destroy", 7, newSViv(netsplit->destroy), 0);
- stash = gv_stashpv("Irssi::Irc::Netsplitserver", 0);
- hv_store(hv, "server", 6, new_bless(netsplit->server, stash), 0);
+ hv_store(hv, "server", 6,
+ plain_bless(netsplit->server,
+ "Irssi::Irc::Netsplitserver"), 0);
- stash = gv_stashpv("Irssi::Irc::Netsplitchannel", 0);
av = newAV();
for (tmp = netsplit->channels; tmp != NULL; tmp = tmp->next) {
- av_push(av, sv_2mortal(new_bless(tmp->data, stash)));
+ av_push(av, plain_bless(tmp->data,
+ "Irssi::Irc::Netsplitchannel"));
}
hv_store(hv, "channels", 7, newRV_noinc((SV*)av), 0);
}
diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c
index 50ec6c2d..774cd87d 100644
--- a/src/perl/perl-common.c
+++ b/src/perl/perl-common.c
@@ -336,7 +336,6 @@ static void perl_ignore_fill_hash(HV *hv, IGNORE_REC *ignore)
static void perl_log_fill_hash(HV *hv, LOG_REC *log)
{
- HV *stash;
AV *av;
GSList *tmp;
@@ -349,12 +348,11 @@ static void perl_log_fill_hash(HV *hv, LOG_REC *log)
hv_store(hv, "failed", 6, newSViv(log->failed), 0);
hv_store(hv, "temp", 4, newSViv(log->temp), 0);
- stash = gv_stashpv("Irssi::Logitem", 0);
av = newAV();
for (tmp = log->items; tmp != NULL; tmp = tmp->next) {
- av_push(av, sv_2mortal(new_bless(tmp->data, stash)));
+ av_push(av, plain_bless(tmp->data, "Irssi::Logitem"));
}
- hv_store(hv, "items", 4, newRV_noinc((SV*)av), 0);
+ hv_store(hv, "items", 5, newRV_noinc((SV*)av), 0);
}
static void perl_log_item_fill_hash(HV *hv, LOG_ITEM_REC *item)
diff --git a/src/perl/perl-common.h b/src/perl/perl-common.h
index 5489a77d..26410ccd 100644
--- a/src/perl/perl-common.h
+++ b/src/perl/perl-common.h
@@ -5,9 +5,6 @@
#define new_pv(a) \
(newSVpv((a) == NULL ? "" : (a), (a) == NULL ? 0 : strlen(a)))
-#define new_bless(obj, stash) \
- sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(obj))), stash)
-
#define is_hvref(o) \
((o) && SvROK(o) && SvRV(o) && (SvTYPE(SvRV(o)) == SVt_PVHV))
diff --git a/src/perl/perl-fe.c b/src/perl/perl-fe.c
index 6aca6262..a41b71c7 100644
--- a/src/perl/perl-fe.c
+++ b/src/perl/perl-fe.c
@@ -30,8 +30,6 @@
static void perl_process_fill_hash(HV *hv, PROCESS_REC *process)
{
- HV *stash;
-
hv_store(hv, "id", 2, newSViv(process->id), 0);
hv_store(hv, "name", 4, new_pv(process->name), 0);
hv_store(hv, "args", 4, new_pv(process->args), 0);
@@ -39,8 +37,8 @@ static void perl_process_fill_hash(HV *hv, PROCESS_REC *process)
hv_store(hv, "pid", 3, newSViv(process->pid), 0);
hv_store(hv, "target", 6, new_pv(process->target), 0);
if (process->target_win != NULL) {
- stash = gv_stashpv("Irssi::Window", 0);
- hv_store(hv, "target_win", 10, sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(process->target_win))), stash), 0);
+ hv_store(hv, "target_win", 10,
+ plain_bless(process->target_win, "Irssi::Window"), 0);
}
hv_store(hv, "shell", 5, newSViv(process->shell), 0);
hv_store(hv, "notice", 6, newSViv(process->notice), 0);
@@ -66,10 +64,7 @@ static void perl_window_fill_hash(HV *hv, WINDOW_REC *window)
static void perl_text_dest_fill_hash(HV *hv, TEXT_DEST_REC *dest)
{
- HV *stash;
-
- stash = gv_stashpv("Irssi::Window", 0);
- hv_store(hv, "window", 6, sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(dest->window))), stash), 0);
+ hv_store(hv, "window", 6, plain_bless(dest->window, "Irssi::Window"), 0);
hv_store(hv, "server", 6, irssi_bless(dest->server), 0);
hv_store(hv, "target", 6, new_pv(dest->target), 0);
hv_store(hv, "level", 5, newSViv(dest->level), 0);