pidgin: 4a3d028f: Some cleanup and a couple leak fixes.
datallah at pidgin.im
datallah at pidgin.im
Wed Aug 6 21:50:43 EDT 2008
-----------------------------------------------------------------
Revision: 4a3d028fb83bb5102638a9d78bda5b354b2d304e
Ancestor: c07ebf2073bbd51862e773cab582fc75e97f3617
Author: datallah at pidgin.im
Date: 2008-08-07T01:41:44
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/4a3d028fb83bb5102638a9d78bda5b354b2d304e
Modified files:
libpurple/plugins/perl/common/Account.xs
libpurple/plugins/perl/common/AccountOpts.xs
libpurple/plugins/perl/common/BuddyList.xs
libpurple/plugins/perl/common/Conversation.xs
libpurple/plugins/perl/common/PluginPref.xs
libpurple/plugins/perl/common/Prefs.xs
libpurple/plugins/perl/common/Roomlist.xs
libpurple/plugins/perl/common/Server.xs
libpurple/plugins/perl/common/Status.xs
libpurple/plugins/perl/perl-common.c
libpurple/plugins/perl/perl-handlers.c
libpurple/plugins/perl/perl.c
ChangeLog:
Some cleanup and a couple leak fixes.
-------------- next part --------------
============================================================
--- libpurple/plugins/perl/common/Account.xs b1cdb75396617829d2d974784755f836e0dfd3a2
+++ libpurple/plugins/perl/common/Account.xs a83ea814db86d377b4817cc538bcd888084fa999
@@ -107,10 +107,9 @@ PPCODE:
t_GL = NULL;
t_len = av_len((AV *)SvRV(status_types));
- for (i = 0; i < t_len; i++) {
- STRLEN t_sl;
- t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(status_types), i, 0), t_sl));
- }
+ for (i = 0; i < t_len; i++)
+ t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(status_types), i, 0)));
+
purple_account_set_status_types(account, t_GL);
void
@@ -210,10 +209,9 @@ PPCODE:
t_GL = NULL;
t_len = av_len((AV *)SvRV(list));
- for (i = 0; i < t_len; i++) {
- STRLEN t_sl;
- t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(list), i, 0), t_sl));
- }
+ for (i = 0; i < t_len; i++)
+ t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(list), i, 0)));
+
purple_account_add_buddies(account, t_GL);
g_list_free(t_GL);
@@ -240,18 +238,15 @@ PPCODE:
t_GL1 = NULL;
t_len = av_len((AV *)SvRV(A));
- for (i = 0; i < t_len; i++) {
- STRLEN t_sl;
- t_GL1 = g_list_append(t_GL1, SvPV(*av_fetch((AV *)SvRV(A), i, 0), t_sl));
- }
+ for (i = 0; i < t_len; i++)
+ t_GL1 = g_list_append(t_GL1, SvPVutf8_nolen(*av_fetch((AV *)SvRV(A), i, 0)));
t_GL2 = NULL;
t_len = av_len((AV *)SvRV(B));
- for (i = 0; i < t_len; i++) {
- STRLEN t_sl;
- t_GL2 = g_list_append(t_GL2, SvPV(*av_fetch((AV *)SvRV(B), i, 0), t_sl));
- }
+ for (i = 0; i < t_len; i++)
+ t_GL2 = g_list_append(t_GL2, SvPVutf8_nolen(*av_fetch((AV *)SvRV(B), i, 0)));
+
purple_account_remove_buddies(account, t_GL1, t_GL2);
g_list_free(t_GL1);
g_list_free(t_GL2);
============================================================
--- libpurple/plugins/perl/common/AccountOpts.xs f54556279596631a6a4ede69f18e13fdc121d2c6
+++ libpurple/plugins/perl/common/AccountOpts.xs 6a4b8903ca9c3add4dfc081b981e2d496fc56628
@@ -44,10 +44,9 @@ CODE:
t_GL = NULL;
t_len = av_len((AV *)SvRV(values));
- for (i = 0; i < t_len; i++) {
- STRLEN t_sl;
- t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(values), i, 0), t_sl));
- }
+ for (i = 0; i < t_len; i++)
+ t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(values), i, 0)));
+
RETVAL = purple_account_option_list_new(text, pref_name, t_GL);
OUTPUT:
RETVAL
@@ -133,10 +132,9 @@ PPCODE:
t_GL = NULL;
t_len = av_len((AV *)SvRV(values));
- for (i = 0; i < t_len; i++) {
- STRLEN t_sl;
- t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(values), i, 0), t_sl));
- }
+ for (i = 0; i < t_len; i++)
+ t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(values), i, 0)));
+
purple_account_option_set_list(option, t_GL);
void
============================================================
--- libpurple/plugins/perl/common/BuddyList.xs 8c35302f0b1916013aa8b3b54aaf66ceeb02c64b
+++ libpurple/plugins/perl/common/BuddyList.xs 57e669b305b0533a7d43b7d7dd9a5ddbeb22bb8f
@@ -362,7 +362,7 @@ CODE:
for (t_HE = hv_iternext(t_HV); t_HE != NULL; t_HE = hv_iternext(t_HV) ) {
t_key = hv_iterkey(t_HE, &len);
t_SV = *hv_fetch(t_HV, t_key, len, 0);
- t_value = SvPV(t_SV, PL_na);
+ t_value = SvPVutf8_nolen(t_SV);
g_hash_table_insert(t_GHash, t_key, t_value);
}
============================================================
--- libpurple/plugins/perl/common/Conversation.xs c02c9b0c797ce5cdc6bb877056ed0103de1e0411
+++ libpurple/plugins/perl/common/Conversation.xs 73ea4dc9a526d9fc224b5d0e985ee5958a2a9260
@@ -342,10 +342,8 @@ PPCODE:
t_GL = NULL;
t_len = av_len((AV *)SvRV(users));
- for (i = 0; i < t_len; i++) {
- STRLEN t_sl;
- t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(users), i, 0), t_sl));
- }
+ for (i = 0; i < t_len; i++)
+ t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(users), i, 0)));
for (l = purple_conv_chat_set_users(chat, t_GL); l != NULL; l = l->next) {
XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry")));
@@ -382,10 +380,8 @@ PPCODE:
t_GL = NULL;
t_len = av_len((AV *)SvRV(ignored));
- for (i = 0; i < t_len; i++) {
- STRLEN t_sl;
- t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(ignored), i, 0), t_sl));
- }
+ for (i = 0; i < t_len; i++)
+ t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(ignored), i, 0)));
for (l = purple_conv_chat_set_ignored(chat, t_GL); l != NULL; l = l->next) {
XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::ListEntry")));
@@ -441,26 +437,20 @@ PPCODE:
t_GL_users = NULL;
t_len = av_len((AV *)SvRV(users));
- for (i = 0; i < t_len; i++) {
- STRLEN t_sl;
- t_GL_users = g_list_append(t_GL_users, SvPV(*av_fetch((AV *)SvRV(users), i, 0), t_sl));
- }
+ for (i = 0; i < t_len; i++)
+ t_GL_users = g_list_append(t_GL_users, SvPVutf8_nolen(*av_fetch((AV *)SvRV(users), i, 0)));
t_GL_flags = NULL;
t_len = av_len((AV *)SvRV(flags));
- for (i = 0; i < t_len; i++) {
- STRLEN t_sl;
- t_GL_flags = g_list_append(t_GL_flags, SvPV(*av_fetch((AV *)SvRV(flags), i, 0), t_sl));
- }
+ for (i = 0; i < t_len; i++)
+ t_GL_flags = g_list_append(t_GL_flags, SvPVutf8_nolen(*av_fetch((AV *)SvRV(flags), i, 0)));
t_GL_extra_msgs = NULL;
t_len = av_len((AV *)SvRV(extra_msgs));
- for (i = 0; i < t_len; i++) {
- STRLEN t_sl;
- t_GL_extra_msgs = g_list_append(t_GL_extra_msgs, SvPV(*av_fetch((AV *)SvRV(extra_msgs), i, 0), t_sl));
- }
+ for (i = 0; i < t_len; i++)
+ t_GL_extra_msgs = g_list_append(t_GL_extra_msgs, SvPVutf8_nolen(*av_fetch((AV *)SvRV(extra_msgs), i, 0)));
purple_conv_chat_add_users(chat, t_GL_users, t_GL_extra_msgs, t_GL_flags, new_arrivals);
============================================================
--- libpurple/plugins/perl/common/PluginPref.xs a9b719e549b59aabd58335da8a0dd1fa064ffac0
+++ libpurple/plugins/perl/common/PluginPref.xs aabb154b060611b2c782b5785483b78ce534e002
@@ -62,7 +62,7 @@ purple_plugin_pref_add_choice(pref, labe
const char *label
# Do the appropriate conversion based on the perl type specified.
# Currently only Strings and Ints will work.
- gpointer choice = (SvPOKp($arg) ? SvPV($arg, PL_na) : (SvIOKp($arg) ? GINT_TO_POINTER(SvIV($arg)) : NULL));
+ gpointer choice = (SvPOKp($arg) ? SvPVutf8_nolen($arg) : (SvIOKp($arg) ? GINT_TO_POINTER(SvIV($arg)) : NULL));
void
purple_plugin_pref_destroy(pref)
============================================================
--- libpurple/plugins/perl/common/Prefs.xs edfcbd4bd9a29574af611d085c0d3c6f1cd751d2
+++ libpurple/plugins/perl/common/Prefs.xs f2e7e8372d62638b75bc3f72f2ff25481b5f92ec
@@ -53,10 +53,9 @@ PPCODE:
t_GL = NULL;
t_len = av_len((AV *)SvRV(value));
- for (i = 0; i < t_len; i++) {
- STRLEN t_sl;
- t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(value), i, 0), t_sl));
- }
+ for (i = 0; i < t_len; i++)
+ t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0)));
+
purple_prefs_add_string_list(name, t_GL);
g_list_free(t_GL);
@@ -171,10 +170,9 @@ PPCODE:
t_GL = NULL;
t_len = av_len((AV *)SvRV(value));
- for (i = 0; i < t_len; i++) {
- STRLEN t_sl;
- t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(value), i, 0), t_sl));
- }
+ for (i = 0; i < t_len; i++)
+ t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0)));
+
purple_prefs_set_string_list(name, t_GL);
g_list_free(t_GL);
============================================================
--- libpurple/plugins/perl/common/Roomlist.xs ca53082d555382a4645ce75d613043a492e1c69a
+++ libpurple/plugins/perl/common/Roomlist.xs 7f864a6add3f0975da04833e51adc5cd8baedc73
@@ -84,10 +84,9 @@ PPCODE:
t_GL = NULL;
t_len = av_len((AV *)SvRV(fields));
- for (i = 0; i < t_len; i++) {
- STRLEN t_sl;
- t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(fields), i, 0), t_sl));
- }
+ for (i = 0; i < t_len; i++)
+ t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(fields), i, 0)));
+
purple_roomlist_set_fields(list, t_GL);
void
============================================================
--- libpurple/plugins/perl/common/Server.xs d6abb1693f708dd1eac12af9d96aaedc0f03c647
+++ libpurple/plugins/perl/common/Server.xs 5eb2d711e3c3b2a8baa4491db3b7b2b87f3bed32
@@ -85,7 +85,7 @@ CODE:
for (t_HE = hv_iternext(t_HV); t_HE != NULL; t_HE = hv_iternext(t_HV) ) {
t_key = hv_iterkey(t_HE, &len);
t_SV = *hv_fetch(t_HV, t_key, len, 0);
- t_value = SvPV(t_SV, PL_na);
+ t_value = SvPVutf8_nolen(t_SV);
g_hash_table_insert(t_GHash, t_key, t_value);
}
@@ -140,7 +140,7 @@ CODE:
for (t_HE = hv_iternext(t_HV); t_HE != NULL; t_HE = hv_iternext(t_HV) ) {
t_key = hv_iterkey(t_HE, &len);
t_SV = *hv_fetch(t_HV, t_key, len, 0);
- t_value = SvPV(t_SV, PL_na);
+ t_value = SvPVutf8_nolen(t_SV);
g_hash_table_insert(t_GHash, t_key, t_value);
}
@@ -170,7 +170,7 @@ CODE:
for (t_HE = hv_iternext(t_HV); t_HE != NULL; t_HE = hv_iternext(t_HV) ) {
t_key = hv_iterkey(t_HE, &len);
t_SV = *hv_fetch(t_HV, t_key, len, 0);
- t_value = SvPV(t_SV, PL_na);
+ t_value = SvPVutf8_nolen(t_SV);
g_hash_table_insert(t_GHash, t_key, t_value);
}
============================================================
--- libpurple/plugins/perl/common/Status.xs e82b21edc6bb1c5f1b5955b4fb1d2a9a363f9d71
+++ libpurple/plugins/perl/common/Status.xs f9abdbbf08dd2535baedad32221a26c2f31301e3
@@ -86,8 +86,7 @@ PPCODE:
t_len = av_len((AV *)SvRV(source_list));
for (i = 0; i < t_len; i++) {
- STRLEN t_sl;
- t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(source_list), i, 0), t_sl));
+ t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(source_list), i, 0)));
}
purple_presence_add_list(presence, t_GL);
g_list_free(t_GL);
@@ -389,8 +388,7 @@ CODE:
t_len = av_len((AV *)SvRV(status_types));
for (i = 0; i < t_len; i++) {
- STRLEN t_sl;
- t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(status_types), i, 0), t_sl));
+ t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(status_types), i, 0)));
}
RETVAL = (PurpleStatusType *)purple_status_type_find_with_id(t_GL, id);
g_list_free(t_GL);
============================================================
--- libpurple/plugins/perl/perl-common.c c3e097d6a584a3413073f7ea0a45125535b59be2
+++ libpurple/plugins/perl/perl-common.c b2c1cda07f18d359367bf2ec17e8166de1f40576
@@ -176,7 +176,6 @@ execute_perl(const char *function, int a
{
int count = 0, i, ret_value = 1;
SV *sv_args[argc];
- STRLEN na;
dSP;
PERL_SET_CONTEXT(my_perl);
/*
@@ -207,7 +206,7 @@ execute_perl(const char *function, int a
if (SvTRUE(ERRSV)) {
purple_debug(PURPLE_DEBUG_ERROR, "perl",
"Perl function %s exited abnormally: %s\n",
- function, SvPV(ERRSV, na));
+ function, SvPVutf8_nolen(ERRSV));
(void)POPs;
} else if (count != 1) {
/*
@@ -235,7 +234,7 @@ execute_perl(const char *function, int a
* of hackish. I should fix it. Look how long this comment is.
* Holy crap.
*/
- args[i] = g_strdup(SvPV(sv_args[i], na));
+ args[i] = g_strdup(SvPVutf8_nolen(sv_args[i]));
}
}
@@ -381,7 +380,6 @@ purple_perl_data_from_sv(PurpleValue *va
void *
purple_perl_data_from_sv(PurpleValue *value, SV *sv)
{
- STRLEN na;
switch (purple_value_get_type(value)) {
case PURPLE_TYPE_BOOLEAN: return (void *)SvIV(sv);
@@ -391,7 +389,7 @@ purple_perl_data_from_sv(PurpleValue *va
case PURPLE_TYPE_ULONG: return (void *)SvUV(sv);
case PURPLE_TYPE_INT64: return (void *)SvIV(sv);
case PURPLE_TYPE_UINT64: return (void *)SvUV(sv);
- case PURPLE_TYPE_STRING: return g_strdup((void *)SvPV(sv, na));
+ case PURPLE_TYPE_STRING: return g_strdup(SvPVutf8_nolen(sv));
case PURPLE_TYPE_POINTER: return (void *)SvIV(sv);
case PURPLE_TYPE_BOXED: return (void *)SvIV(sv);
============================================================
--- libpurple/plugins/perl/perl-handlers.c 53a28cabfff452d1b8639c829f6872aaae2d7e74
+++ libpurple/plugins/perl/perl-handlers.c d9c95b2f090211be097164eafe8cac02cce0faf6
@@ -23,7 +23,6 @@ purple_perl_plugin_action_cb(PurplePlugi
gchar *hvname;
PurplePlugin *plugin;
PurplePerlScript *gps;
- STRLEN na;
dSP;
plugin = action->plugin;
@@ -54,7 +53,7 @@ purple_perl_plugin_action_cb(PurplePlugi
if (SvTRUE(ERRSV)) {
purple_debug_error("perl",
"Perl plugin action function exited abnormally: %s\n",
- SvPV(ERRSV, na));
+ SvPVutf8_nolen(ERRSV));
}
PUTBACK;
@@ -68,7 +67,6 @@ purple_perl_plugin_actions(PurplePlugin
GList *l = NULL;
PurplePerlScript *gps;
int i = 0, count = 0;
- STRLEN na;
dSP;
gps = plugin->info->extra_info;
@@ -94,7 +92,7 @@ purple_perl_plugin_actions(PurplePlugin
if (SvTRUE(ERRSV)) {
purple_debug_error("perl",
"Perl plugin actions lookup exited abnormally: %s\n",
- SvPV(ERRSV, na));
+ SvPVutf8_nolen(ERRSV));
}
if (count == 0)
@@ -102,14 +100,10 @@ purple_perl_plugin_actions(PurplePlugin
for (i = 0; i < count; i++) {
SV *sv;
- gchar *label;
- PurplePluginAction *act = NULL;
+ PurplePluginAction *act;
sv = POPs;
- label = SvPV_nolen(sv);
- /* XXX I think this leaks, but doing it without the strdup
- * just showed garbage */
- act = purple_plugin_action_new(g_strdup(label), purple_perl_plugin_action_cb);
+ act = purple_plugin_action_new(SvPVutf8_nolen(sv), purple_perl_plugin_action_cb);
l = g_list_prepend(l, act);
}
@@ -129,7 +123,6 @@ purple_perl_gtk_get_plugin_frame(PurpleP
MAGIC *mg;
GtkWidget *ret;
PurplePerlScript *gps;
- STRLEN na;
dSP;
gps = plugin->info->extra_info;
@@ -147,7 +140,7 @@ purple_perl_gtk_get_plugin_frame(PurpleP
if (SvTRUE(ERRSV)) {
purple_debug_error("perl",
"Perl gtk plugin frame init exited abnormally: %s\n",
- SvPV(ERRSV, na));
+ SvPVutf8_nolen(ERRSV));
}
/* We have a Gtk2::Frame on top of the stack */
@@ -173,7 +166,6 @@ purple_perl_get_plugin_frame(PurplePlugi
int count;
PurplePerlScript *gps;
PurplePluginPrefFrame *ret_frame;
- STRLEN na;
dSP;
gps = (PurplePerlScript *)plugin->info->extra_info;
@@ -192,7 +184,7 @@ purple_perl_get_plugin_frame(PurplePlugi
if (SvTRUE(ERRSV)) {
purple_debug_error("perl",
"Perl plugin prefs frame init exited abnormally: %s\n",
- SvPV(ERRSV, na));
+ SvPVutf8_nolen(ERRSV));
}
if (count != 1)
@@ -249,7 +241,6 @@ perl_timeout_cb(gpointer data)
{
PurplePerlTimeoutHandler *handler = data;
gboolean ret = FALSE;
- STRLEN na;
dSP;
ENTER;
@@ -263,7 +254,7 @@ perl_timeout_cb(gpointer data)
if (SvTRUE(ERRSV)) {
purple_debug_error("perl",
"Perl timeout function exited abnormally: %s\n",
- SvPV(ERRSV, na));
+ SvPVutf8_nolen(ERRSV));
}
ret = POPi;
@@ -291,7 +282,6 @@ perl_signal_cb(va_list args, void *data)
PurpleValue *ret_value, **values;
SV **sv_args;
DATATYPE **copy_args;
- STRLEN na;
dSP;
ENTER;
@@ -334,7 +324,7 @@ perl_signal_cb(va_list args, void *data)
if (SvTRUE(ERRSV)) {
purple_debug_error("perl",
"Perl function exited abnormally: %s\n",
- SvPV(ERRSV, na));
+ SvPVutf8_nolen(ERRSV));
}
/* See if any parameters changed. */
@@ -373,14 +363,13 @@ perl_signal_cb(va_list args, void *data)
if (strcmp(*((char **)copy_args[i]), SvPVX(sv_args[i]))) {
g_free(*((char **)copy_args[i]));
*((char **)copy_args[i]) =
- g_strdup(SvPV(sv_args[i], na));
+ g_strdup(SvPVutf8_nolen(sv_args[i]));
}
+ /* Clean up sv_args[i] - we're done with it */
+ sv_2mortal(sv_args[i]);
break;
case PURPLE_TYPE_POINTER:
- *((void **)copy_args[i]) = (void *)SvIV(sv_args[i]);
- break;
-
case PURPLE_TYPE_BOXED:
*((void **)copy_args[i]) = (void *)SvIV(sv_args[i]);
break;
@@ -392,6 +381,7 @@ perl_signal_cb(va_list args, void *data)
break;
}
+
#if 0
*((void **)copy_args[i]) = purple_perl_data_from_sv(values[i],
sv_args[i]);
@@ -564,7 +554,6 @@ perl_cmd_cb(PurpleConversation *conv, co
gchar **args, gchar **error, void *data)
{
int i = 0, count, ret_value = PURPLE_CMD_RET_OK;
- STRLEN na;
SV *cmdSV, *tmpSV, *convSV;
PurplePerlCmdHandler *handler = data;
@@ -604,7 +593,7 @@ perl_cmd_cb(PurpleConversation *conv, co
if (SvTRUE(ERRSV)) {
purple_debug_error("perl",
"Perl plugin command function exited abnormally: %s\n",
- SvPV(ERRSV, na));
+ SvPVutf8_nolen(ERRSV));
}
SPAGAIN;
@@ -718,7 +707,6 @@ perl_pref_cb(const char *name, PurplePre
gpointer data)
{
PurplePerlPrefsHandler *handler = data;
- STRLEN na;
dSP;
ENTER;
@@ -767,7 +755,7 @@ perl_pref_cb(const char *name, PurplePre
if (SvTRUE(ERRSV)) {
purple_debug_error("perl",
"Perl prefs callback function exited abnormally: %s\n",
- SvPV(ERRSV, na));
+ SvPVutf8_nolen(ERRSV));
}
PUTBACK;
============================================================
--- libpurple/plugins/perl/perl.c 82362342ad09a0397de6e6e9574f6ceebe772c86
+++ libpurple/plugins/perl/perl.c c897085f683576fb602a4f5ca16ee7c4e3ad5de2
@@ -288,24 +288,24 @@ probe_perl_plugin(PurplePlugin *plugin)
ret = perl_parse(prober, xs_init, argc, argv, NULL);
if (ret != 0) {
- STRLEN len;
const char * errmsg = "Unknown error";
if (SvTRUE(ERRSV))
- errmsg = SvPV(ERRSV, len);
+ errmsg = SvPVutf8_nolen(ERRSV);
purple_debug_error("perl", "Unable to parse plugin %s (%d:%s)\n",
plugin->path, ret, errmsg);
+ status = FALSE;
goto cleanup;
}
ret = perl_run(prober);
if (ret != 0) {
- STRLEN len;
const char * errmsg = "Unknown error";
if (SvTRUE(ERRSV))
- errmsg = SvPV(ERRSV, len);
+ errmsg = SvPVutf8_nolen(ERRSV);
purple_debug_error("perl", "Unable to run perl interpreter on plugin %s (%d:%s)\n",
plugin->path, ret, errmsg);
+ status = FALSE;
goto cleanup;
}
@@ -335,7 +335,6 @@ probe_perl_plugin(PurplePlugin *plugin)
PurplePluginInfo *info;
PurplePerlScript *gps;
char *basename;
- STRLEN len;
info = g_new0(PurplePluginInfo, 1);
gps = g_new0(PurplePerlScript, 1);
@@ -358,9 +357,9 @@ probe_perl_plugin(PurplePlugin *plugin)
/* We know this one exists. */
key = hv_fetch(plugin_info, "name", strlen("name"), 0);
- info->name = g_strdup(SvPV(*key, len));
+ info->name = g_strdup(SvPVutf8_nolen(*key));
/* Set id here in case we don't find one later. */
- info->id = g_strdup(SvPV(*key, len));
+ info->id = g_strdup(info->name);
#ifdef PURPLE_GTKPERL
if ((key = hv_fetch(plugin_info, "GTK_UI",
@@ -370,40 +369,40 @@ probe_perl_plugin(PurplePlugin *plugin)
if ((key = hv_fetch(plugin_info, "url",
strlen("url"), 0)))
- info->homepage = g_strdup(SvPV(*key, len));
+ info->homepage = g_strdup(SvPVutf8_nolen(*key));
if ((key = hv_fetch(plugin_info, "author",
strlen("author"), 0)))
- info->author = g_strdup(SvPV(*key, len));
+ info->author = g_strdup(SvPVutf8_nolen(*key));
if ((key = hv_fetch(plugin_info, "summary",
strlen("summary"), 0)))
- info->summary = g_strdup(SvPV(*key, len));
+ info->summary = g_strdup(SvPVutf8_nolen(*key));
if ((key = hv_fetch(plugin_info, "description",
strlen("description"), 0)))
- info->description = g_strdup(SvPV(*key, len));
+ info->description = g_strdup(SvPVutf8_nolen(*key));
if ((key = hv_fetch(plugin_info, "version",
strlen("version"), 0)))
- info->version = g_strdup(SvPV(*key, len));
+ info->version = g_strdup(SvPVutf8_nolen(*key));
/* We know this one exists. */
key = hv_fetch(plugin_info, "load", strlen("load"), 0);
gps->load_sub = g_strdup_printf("%s::%s", gps->package,
- SvPV(*key, len));
+ SvPVutf8_nolen(*key));
if ((key = hv_fetch(plugin_info, "unload",
strlen("unload"), 0)))
gps->unload_sub = g_strdup_printf("%s::%s",
gps->package,
- SvPV(*key, len));
+ SvPVutf8_nolen(*key));
if ((key = hv_fetch(plugin_info, "id",
strlen("id"), 0))) {
g_free(info->id);
info->id = g_strdup_printf("perl-%s",
- SvPV(*key, len));
+ SvPVutf8_nolen(*key));
}
/********************************************************/
@@ -424,7 +423,7 @@ probe_perl_plugin(PurplePlugin *plugin)
* will create a frame for us */
gps->prefs_sub = g_strdup_printf("%s::%s",
gps->package,
- SvPV(*key, len));
+ SvPVutf8_nolen(*key));
info->prefs_info = &ui_info;
}
@@ -435,7 +434,7 @@ probe_perl_plugin(PurplePlugin *plugin)
* will create a frame for us */
gps->gtk_prefs_sub = g_strdup_printf("%s::%s",
gps->package,
- SvPV(*key, len));
+ SvPVutf8_nolen(*key));
info->ui_info = >k_ui_info;
}
#endif
@@ -444,7 +443,7 @@ probe_perl_plugin(PurplePlugin *plugin)
strlen("plugin_action_sub"), 0))) {
gps->plugin_action_sub = g_strdup_printf("%s::%s",
gps->package,
- SvPV(*key, len));
+ SvPVutf8_nolen(*key));
info->actions = purple_perl_plugin_actions;
}
@@ -499,11 +498,9 @@ load_perl_plugin(PurplePlugin *plugin)
SPAGAIN;
if (SvTRUE(ERRSV)) {
- STRLEN len;
-
purple_debug(PURPLE_DEBUG_ERROR, "perl",
"Perl function %s exited abnormally: %s\n",
- gps->load_sub, SvPV(ERRSV, len));
+ gps->load_sub, SvPVutf8_nolen(ERRSV));
}
PUTBACK;
@@ -525,7 +522,7 @@ destroy_package(const char *package)
SAVETMPS;
PUSHMARK(SP);
- XPUSHs(sv_2mortal(newSVpv(package, strlen(package))));
+ XPUSHs(sv_2mortal(newSVpv(package, 0)));
PUTBACK;
perl_call_pv("Purple::PerlLoader::destroy_package",
@@ -563,11 +560,9 @@ unload_perl_plugin(PurplePlugin *plugin)
SPAGAIN;
if (SvTRUE(ERRSV)) {
- STRLEN len;
-
purple_debug(PURPLE_DEBUG_ERROR, "perl",
"Perl function %s exited abnormally: %s\n",
- gps->load_sub, SvPV(ERRSV, len));
+ gps->unload_sub, SvPVutf8_nolen(ERRSV));
}
PUTBACK;
@@ -592,21 +587,23 @@ destroy_perl_plugin(PurplePlugin *plugin
PurplePerlScript *gps;
g_free(plugin->info->name);
- g_free(plugin->info->version);
+ g_free(plugin->info->id);
+ g_free(plugin->info->homepage);
+ g_free(plugin->info->author);
g_free(plugin->info->summary);
g_free(plugin->info->description);
- g_free(plugin->info->author);
- g_free(plugin->info->homepage);
+ g_free(plugin->info->version);
gps = (PurplePerlScript *)plugin->info->extra_info;
if (gps != NULL) {
+ g_free(gps->package);
g_free(gps->load_sub);
g_free(gps->unload_sub);
- g_free(gps->package);
g_free(gps->prefs_sub);
#ifdef PURPLE_GTKPERL
g_free(gps->gtk_prefs_sub);
#endif
+ g_free(gps->plugin_action_sub);
g_free(gps);
plugin->info->extra_info = NULL;
}
More information about the Commits
mailing list