im.pidgin.pidgin: 51648da970800504c5fef1552e7475982f977904
deryni at pidgin.im
deryni at pidgin.im
Tue Dec 4 19:22:50 EST 2007
-----------------------------------------------------------------
Revision: 51648da970800504c5fef1552e7475982f977904
Ancestor: 2ffbc249cf14de9e738c76f8cdb0f55d32cdbf03
Author: deryni at pidgin.im
Date: 2007-12-01T06:45:05
Branch: im.pidgin.pidgin
Modified files:
libpurple/plugins/perl/common/BuddyList.xs
libpurple/plugins/perl/common/Log.xs
libpurple/plugins/perl/common/Prpl.xs
ChangeLog:
A couple more similar leak fixes though some of these still leak if the
calling perl code doesn't clean up after the call. But there isn't a good way
around that at the moment.
-------------- next part --------------
============================================================
--- libpurple/plugins/perl/common/BuddyList.xs 7ebfaff687bd987caf8bca1af40a03bbb2acbf06
+++ libpurple/plugins/perl/common/BuddyList.xs 8c35302f0b1916013aa8b3b54aaf66ceeb02c64b
@@ -44,11 +44,13 @@ PREINIT:
Purple::Account account
const char * name
PREINIT:
- GSList *l;
+ GSList *l, *ll;
PPCODE:
- for (l = purple_find_buddies(account, name); l != NULL; l = l->next) {
+ ll = purple_find_buddies(account, name);
+ for (l = ll; l != NULL; l = l->next) {
XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::BuddyList::Buddy")));
}
+ g_slist_free(ll);
Purple::BuddyList::Group
purple_find_group(name)
@@ -101,11 +103,13 @@ PREINIT:
purple_group_get_accounts(group)
Purple::BuddyList::Group group
PREINIT:
- GSList *l;
+ GSList *l, *ll;
PPCODE:
- for (l = purple_group_get_accounts(group); l != NULL; l = l->next) {
+ ll = purple_group_get_accounts(group);
+ for (l = ll; l != NULL; l = l->next) {
XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Account")));
}
+ g_slist_free(ll);
gboolean
purple_group_on_account(group, account)
@@ -268,11 +272,15 @@ PREINIT:
purple_blist_node_get_extended_menu(node)
Purple::BuddyList::Node node
PREINIT:
- GList *l;
+ GList *l, *ll;
PPCODE:
- for (l = purple_blist_node_get_extended_menu(node); l != NULL; l = g_list_delete_link(l, l)) {
+ ll = purple_blist_node_get_extended_menu(node);
+ for (l = ll; l != NULL; l = l->next) {
XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Menu::Action")));
}
+ /* We can free the list here but the script needs to free the
+ * Purple::Menu::Action 'objects' itself. */
+ g_list_free(ll);
void
purple_blist_node_set_bool(node, key, value)
============================================================
--- libpurple/plugins/perl/common/Log.xs e2ac791c4f078736333f93ba052eaf00123c0335
+++ libpurple/plugins/perl/common/Log.xs aaa49ba972b17f30bf8c9137b81afc0c8aaf53f6
@@ -65,11 +65,15 @@ PREINIT:
const char *name
Purple::Account account
PREINIT:
- GList *l;
+ GList *l, *ll;
PPCODE:
- for (l = purple_log_get_logs(type, name, account); l != NULL; l = l->next) {
- XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry")));
+ ll = purple_log_get_logs(type, name, account);
+ for (l = ll; l != NULL; l = l->next) {
+ XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Log")));
}
+ /* We can free the list here but the script needs to free the
+ * Purple::Log 'objects' itself. */
+ g_list_free(ll);
int
purple_log_get_size(log)
@@ -79,11 +83,15 @@ PREINIT:
purple_log_get_system_logs(account)
Purple::Account account
PREINIT:
- GList *l;
+ GList *l, *ll;
PPCODE:
- for (l = purple_log_get_system_logs(account); l != NULL; l = l->next) {
- XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry")));
+ ll = purple_log_get_system_logs(account);
+ for (l = ll; l != NULL; l = l->next) {
+ XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Log")));
}
+ /* We can free the list here but the script needs to free the
+ * Purple::Log 'objects' itself. */
+ g_list_free(ll);
int
purple_log_get_total_size(type, name, account)
@@ -101,11 +109,14 @@ PREINIT:
void
purple_log_logger_get_options()
PREINIT:
- GList *l;
+ GList *l, *ll;
PPCODE:
- for (l = purple_log_logger_get_options(); l != NULL; l = l->next) {
- XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry")));
+ /* This might want to be massaged to a hash, since that's essentially
+ * what the key/value list is emulating. */
+ for (l = ll = purple_log_logger_get_options(); l != NULL; l = l->next) {
+ XPUSHs(sv_2mortal(newSVpv(l->data, 0)));
}
+ g_list_free(ll);
gchar_own *
purple_log_read(log, flags)
============================================================
--- libpurple/plugins/perl/common/Prpl.xs 694d071a8a11c788161e66294cd62f4c32e2cb70
+++ libpurple/plugins/perl/common/Prpl.xs a6518808a5f1de59396ee912f738b225626ed617
@@ -21,13 +21,15 @@ PREINIT:
Purple::Account account
Purple::Presence presence
PREINIT:
- GList *l;
+ GList *l, *ll;
PPCODE:
- for (l = purple_prpl_get_statuses(account,presence); l != NULL; l = l->next) {
- /* XXX Someone please test and make sure this is the right
- * type for these things. */
+ ll = purple_prpl_get_statuses(account,presence);
+ for (l = ll; l != NULL; l = l->next) {
XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Status")));
}
+ /* We can free the list here but the script needs to free the
+ * Purple::Status 'objects' itself. */
+ g_list_free(ll);
void
purple_prpl_got_account_idle(account, idle, idle_time)
More information about the Commits
mailing list