summaryrefslogtreecommitdiff
path: root/src/perl/common/Log.xs
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-12-06 05:03:11 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-12-06 05:03:11 +0000
commite95f309b500e37ceb65f533fa0267a2864511228 (patch)
treee5f9e8705ceaa33fdd6c62c389312652de961865 /src/perl/common/Log.xs
parenta99e93ef5d8dd4002580532ee25316c3860c1e4a (diff)
downloadirssi-e95f309b500e37ceb65f533fa0267a2864511228.zip
perl changes - values() method doesn't exist anymore, instead of
$server->values()->{...} you now use directly $server->{...} git-svn-id: http://svn.irssi.org/repos/irssi/trunk@972 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/perl/common/Log.xs')
-rw-r--r--src/perl/common/Log.xs51
1 files changed, 27 insertions, 24 deletions
diff --git a/src/perl/common/Log.xs b/src/perl/common/Log.xs
index c341cf30..fbef4b72 100644
--- a/src/perl/common/Log.xs
+++ b/src/perl/common/Log.xs
@@ -8,7 +8,7 @@ PREINIT:
PPCODE:
stash = gv_stashpv("Irssi::Log", 0);
for (tmp = logs; tmp != NULL; tmp = tmp->next) {
- XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
+ push_bless(tmp->data, stash);
}
Irssi::Log
@@ -25,29 +25,30 @@ MODULE = Irssi PACKAGE = Irssi::Log PREFIX = log_
#*******************************
void
-values(log)
+init(log)
Irssi::Log log
PREINIT:
HV *hv, *stash;
AV *av;
GSList *tmp;
-PPCODE:
- hv = newHV();
- hv_store(hv, "fname", 5, new_pv(log->fname), 0);
- hv_store(hv, "opened", 6, newSViv(log->opened), 0);
- hv_store(hv, "level", 5, newSViv(log->level), 0);
- hv_store(hv, "last", 4, newSViv(log->last), 0);
- hv_store(hv, "autoopen", 8, newSViv(log->autoopen), 0);
- 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(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
+CODE:
+ hv = hvref(ST(0));
+ if (hv != NULL) {
+ hv_store(hv, "fname", 5, new_pv(log->fname), 0);
+ hv_store(hv, "opened", 6, newSViv(log->opened), 0);
+ hv_store(hv, "level", 5, newSViv(log->level), 0);
+ hv_store(hv, "last", 4, newSViv(log->last), 0);
+ hv_store(hv, "autoopen", 8, newSViv(log->autoopen), 0);
+ 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)));
+ }
+ hv_store(hv, "items", 4, newRV_noinc((SV*)av), 0);
}
- hv_store(hv, "items", 4, newRV_noinc((SV*)av), 0);
- XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
void
log_item_add(log, type, name, server)
@@ -94,12 +95,14 @@ MODULE = Irssi PACKAGE = Irssi::LogItem
#*******************************
void
-values(item)
+init(item)
Irssi::LogItem item
PREINIT:
HV *hv;
-PPCODE:
- hv = newHV();
- hv_store(hv, "type", 4, newSViv(item->type), 0);
- hv_store(hv, "name", 4, new_pv(item->name), 0);
- hv_store(hv, "servertag", 9, new_pv(item->servertag), 0);
+CODE:
+ hv = hvref(ST(0));
+ if (hv != NULL) {
+ hv_store(hv, "type", 4, newSViv(item->type), 0);
+ hv_store(hv, "name", 4, new_pv(item->name), 0);
+ hv_store(hv, "servertag", 9, new_pv(item->servertag), 0);
+ }