changeset 25081:1946af161630

Let XS do the argument checking/erroring for us for the components argument to Purple::Serv::join_chat, we weren't doing any before. Closes #8199.
author Etan Reisner <pidgin@unreliablesource.net>
date Thu, 12 Feb 2009 06:00:15 +0000
parents e0a6a829df87
children eece2d17ab65
files libpurple/plugins/perl/common/Server.xs
diffstat 1 files changed, 13 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/perl/common/Server.xs	Wed Feb 11 03:31:33 2009 +0000
+++ b/libpurple/plugins/perl/common/Server.xs	Thu Feb 12 06:00:15 2009 +0000
@@ -122,29 +122,28 @@
 	Purple::Connection gc
 	const char *name
 
-void 
-serv_join_chat(con, components)
-	Purple::Connection con 
-	SV * components
-INIT:
-	HV * t_HV;
-	HE * t_HE;
-	SV * t_SV;
-	GHashTable * t_GHash;
+void
+serv_join_chat(conn, components)
+	Purple::Connection conn
+	HV * components
+PREINIT:
+	HE *t_HE;
+	SV *t_SV;
 	I32 len;
+	GHashTable *t_GHash;
 	char *t_key, *t_value;
 CODE:
-	t_HV =  (HV *)SvRV(components);
 	t_GHash = g_hash_table_new(g_str_hash, g_str_equal);
 
-	for (t_HE = hv_iternext(t_HV); t_HE != NULL; t_HE = hv_iternext(t_HV) ) {
+	for (t_HE = hv_iternext(components); t_HE != NULL;
+	     t_HE = hv_iternext(components)) {
 		t_key = hv_iterkey(t_HE, &len);
-		t_SV = *hv_fetch(t_HV, t_key, len, 0);
- 		t_value = SvPVutf8_nolen(t_SV);
+		t_SV = *hv_fetch(components, t_key, len, 0);
+		t_value = SvPVutf8_nolen(t_SV);
 
 		g_hash_table_insert(t_GHash, t_key, t_value);
 	}
-	serv_join_chat(con, t_GHash);
+	serv_join_chat(conn, t_GHash);
 
 void 
 serv_move_buddy(buddy, group1, group2)